Go to the documentation of this file.
32 #ifndef ZYDIS_DEFINES_H
33 #define ZYDIS_DEFINES_H
35 #include <ZydisExportConfig.h>
41 #if defined(__clang__)
44 #elif defined(__ICC) || defined(__INTEL_COMPILER)
46 #elif defined(__GNUC__) || defined(__GNUG__)
49 #elif defined(_MSC_VER)
51 #elif defined(__BORLANDC__)
52 # define ZYDIS_BORLAND
54 # define ZYDIS_UNKNOWN_COMPILER
62 # define ZYDIS_WINDOWS
63 #elif defined(__APPLE__)
66 #elif defined(__linux)
72 #elif defined(__posix)
75 # error "Unsupported platform detected"
82 #if defined (_M_AMD64) || defined (__x86_64__)
84 #elif defined (_M_IX86) || defined (__i386__)
87 # error "Unsupported architecture detected"
94 #if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
98 # define ZYDIS_RELEASE
100 #elif defined(ZYDIS_GNUC) || defined(ZYDIS_ICC)
102 # define ZYDIS_RELEASE
107 # error "Unsupported compiler detected"
114 #if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
115 # define ZYDIS_INLINE __inline
117 # define ZYDIS_INLINE static inline
124 #if defined(ZYDIS_WINKERNEL)
125 # define ZYDIS_ASSERT(condition)
128 # define ZYDIS_ASSERT(condition) assert(condition)
131 #if defined(ZYDIS_RELEASE)
132 # if defined(ZYDIS_CLANG)
133 # if __has_builtin(__builtin_unreachable)
134 # define ZYDIS_UNREACHABLE __builtin_unreachable()
136 # define ZYDIS_UNREACHABLE
138 # elif defined(ZYDIS_GCC) && ((__GNUC__ == 4 && __GNUC_MINOR__ > 4) || __GNUC__ > 4)
139 # define ZYDIS_UNREACHABLE __builtin_unreachable()
140 # elif defined(ZYDIS_ICC)
141 # ifdef ZYDIS_WINDOWS
143 # define ZYDIS_UNREACHABLE __assume(0); (void)abort()
145 # define ZYDIS_UNREACHABLE __builtin_unreachable()
147 # elif defined(ZYDIS_MSVC)
148 # define ZYDIS_UNREACHABLE __assume(0)
150 # define ZYDIS_UNREACHABLE
152 #elif defined(ZYDIS_WINKERNEL)
153 # define ZYDIS_UNREACHABLE
156 # define ZYDIS_UNREACHABLE { assert(0); abort(); }
166 #define ZYDIS_BITFIELD(x) : x
171 #define ZYDIS_ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))