| 1 | /* Capstone Disassembly Engine */cxx . . $ `<file>/utils.h`/ |
| 2 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */ |
| 3 | |
| 4 | #ifndef CS_UTILS_H |
| 5 | #define CS_UTILS_Hcxx . . $ `utils.h:5:9`! |
| 6 | |
| 7 | #if defined(CAPSTONE_HAS_OSXKERNEL) |
| 8 | #include <libkern/libkern.h> |
| 9 | #else |
| 10 | #include <stddef.h> |
| 11 | #include "include/capstone/capstone.h"cxx . . $ `<file>/include/capstone/capstone.h`/ |
| 12 | #endif |
| 13 | #include "cs_priv.h"cxx . . $ `<file>/cs_priv.h`/ |
| 14 | #include "Mapping.h"cxx . . $ `<file>/Mapping.h`/ |
| 15 | |
| 16 | // threshold number, so above this number will be printed in hexa mode |
| 17 | #define HEX_THRESHOLDcxx . . $ `utils.h:17:9`! 9 |
| 18 | |
| 19 | // count number of positive members in a list. |
| 20 | // NOTE: list must be guaranteed to end in 0 |
| 21 | unsigned int count_positivecxx . . $ count_positive(ad0aaa07bfcd0593).(const uint16_tcxx . . $ uint16_t# *list); |
| 22 | unsigned int count_positive8cxx . . $ count_positive8(ca1608e2c87725e2).(const unsigned char *list); |
| 23 | |
| 24 | #define ARR_SIZEcxx . . $ `utils.h:24:9`!(a) (sizeof(a)/sizeof(a[0])) |
| 25 | #define MATRIX_SIZEcxx . . $ `utils.h:25:9`!(a) (sizeof(a[0])/sizeof(a[0][0])) |
| 26 | |
| 27 | char *cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(const char *str); |
| 28 | |
| 29 | #define MINcxx . . $ `utils.h:29:9`!(x, y) ((x) < (y) ? (x) : (y)) |
| 30 | |
| 31 | // we need this since Windows doesn't have snprintf() |
| 32 | int cs_snprintfcxx . . $ cs_snprintf(ea502d73e74c754c).(char *buffer, size_tcxx . . $ size_t# size, const char *fmt, ...); |
| 33 | |
| 34 | #define CS_AC_IGNOREcxx . . $ `utils.h:34:9`! (1 << 7) |
| 35 | |
| 36 | // check if an id is existent in an array |
| 37 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! arr_exist8cxx . . $ arr_exist8(ece34ac52943d40).(unsigned char *arr, unsigned char max, unsigned int id); |
| 38 | |
| 39 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! arr_existcxx . . $ arr_exist(c35293ec828d81e3).(uint16_tcxx . . $ uint16_t# *arr, unsigned char max, unsigned int id); |
| 40 | |
| 41 | struct IndexTypecxx . . $ IndexType# { |
| 42 | uint16_tcxx . . $ uint16_t# encodingcxx . . $ IndexType#encoding.; |
| 43 | unsigned indexcxx . . $ IndexType#index.; |
| 44 | }; |
| 45 | |
| 46 | // binary search for encoding in IndexType array |
| 47 | // return -1 if not found, or index if found |
| 48 | unsigned int binsearch_IndexTypeEncodingcxx . . $ binsearch_IndexTypeEncoding(fdc2fa575a0c2ee7).(const struct IndexTypecxx . . $ IndexType# *index, size_tcxx . . $ size_t# size, uint16_tcxx . . $ uint16_t# encoding); |
| 49 | |
| 50 | uint16_tcxx . . $ uint16_t# readBytes16cxx . . $ readBytes16(c1497bf24a45deb).(MCInstcxx . . $ MCInst# *MI, const uint8_tcxx . . $ uint8_t# *Bytes); |
| 51 | uint32_tcxx . . $ uint32_t# readBytes32cxx . . $ readBytes32(baba937dc08fe273).(MCInstcxx . . $ MCInst# *MI, const uint8_tcxx . . $ uint8_t# *Bytes); |
| 52 | |
| 53 | #endif |
| 54 |