Nguyen Anh Quynh | 79e7b34 | 2015-06-08 23:21:44 +0800 | [diff] [blame] | 1 | /* Capstone Disassembly Engine */ |
| 2 | /* By Axel Souchet, 2014 */ |
| 3 | |
Nguyen Anh Quynh | dfe0eed | 2015-06-08 23:32:33 +0800 | [diff] [blame^] | 4 | #ifndef CS_MYINTTYPES_H |
| 5 | #define CS_MYINTTYPES_H |
| 6 | |
Nguyen Anh Quynh | 79e7b34 | 2015-06-08 23:21:44 +0800 | [diff] [blame] | 7 | #if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && _MSC_VER <= 1700) |
| 8 | // this system does not have inttypes.h |
| 9 | |
flyingsymbols | d91f964 | 2014-10-22 03:21:43 -0400 | [diff] [blame] | 10 | #if defined(_MSC_VER) && _MSC_VER <= 1700 |
Nguyen Anh Quynh | 79e7b34 | 2015-06-08 23:21:44 +0800 | [diff] [blame] | 11 | typedef signed char int8_t; |
| 12 | typedef signed short int16_t; |
| 13 | typedef signed int int32_t; |
| 14 | typedef unsigned char uint8_t; |
| 15 | typedef unsigned short uint16_t; |
| 16 | typedef unsigned int uint32_t; |
| 17 | typedef signed long long int64_t; |
| 18 | typedef unsigned long long uint64_t; |
| 19 | #endif |
| 20 | |
| 21 | #define __PRI_8_LENGTH_MODIFIER__ "hh" |
| 22 | #define __PRI_64_LENGTH_MODIFIER__ "ll" |
| 23 | |
| 24 | #define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" |
| 25 | #define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" |
| 26 | #define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" |
| 27 | #define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" |
| 28 | #define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" |
| 29 | #define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" |
| 30 | |
| 31 | #define PRId16 "hd" |
| 32 | #define PRIi16 "hi" |
| 33 | #define PRIo16 "ho" |
| 34 | #define PRIu16 "hu" |
| 35 | #define PRIx16 "hx" |
| 36 | #define PRIX16 "hX" |
| 37 | |
| 38 | #if defined(_MSC_VER) && _MSC_VER <= 1700 |
| 39 | #define PRId32 "ld" |
| 40 | #define PRIi32 "li" |
| 41 | #define PRIo32 "lo" |
| 42 | #define PRIu32 "lu" |
| 43 | #define PRIx32 "lx" |
| 44 | #define PRIX32 "lX" |
| 45 | #else // OSX |
| 46 | #define PRId32 "d" |
| 47 | #define PRIi32 "i" |
| 48 | #define PRIo32 "o" |
| 49 | #define PRIu32 "u" |
| 50 | #define PRIx32 "x" |
| 51 | #define PRIX32 "X" |
| 52 | #endif |
| 53 | |
| 54 | #define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" |
| 55 | #define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" |
| 56 | #define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" |
| 57 | #define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" |
| 58 | #define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" |
| 59 | #define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" |
| 60 | |
| 61 | #else // this system has inttypes.h by default |
Yegor Derevenets | ced9d24 | 2014-09-21 17:27:11 +0200 | [diff] [blame] | 62 | #include <inttypes.h> |
| 63 | #endif |
Nguyen Anh Quynh | dfe0eed | 2015-06-08 23:32:33 +0800 | [diff] [blame^] | 64 | |
| 65 | #endif |