mirror of https://github.com/x64dbg/zydis
Added static assert + verify int type sizes
This commit is contained in:
parent
56f47f4863
commit
486add62ed
|
@ -86,6 +86,17 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Verify assumptions.
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisU8) == 1);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisU16) == 2);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisU32) == 4);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisU64) == 8);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisI8) == 1);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisI16) == 2);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisI32) == 4);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisI64) == 8);
|
||||||
|
ZYDIS_STATIC_ASSERT(sizeof(ZydisUSize) == sizeof(ZydisISize));
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* NULL */
|
/* NULL */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -164,6 +164,15 @@
|
||||||
/* Utils */
|
/* Utils */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compiler-time assertion.
|
||||||
|
*/
|
||||||
|
#if __STDC_VERSION__ >= 201112L
|
||||||
|
# define ZYDIS_STATIC_ASSERT(x) _Static_assert(x, #x)
|
||||||
|
#else
|
||||||
|
# define ZYDIS_STATIC_ASSERT(x) typedef int ZYDIS_SASSERT_IMPL[(x) ? 1 : -1]
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Declares a bitfield.
|
* @brief Declares a bitfield.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue