Add word size detection to Platform.h

This commit is contained in:
Corentin Wallez 2018-05-07 22:38:42 -04:00 committed by Corentin Wallez
parent 8f2050540d
commit 60ffbfc071
1 changed files with 10 additions and 0 deletions

View File

@ -27,4 +27,14 @@
# error "Unsupported platform." # error "Unsupported platform."
#endif #endif
#if defined(_WIN64) || defined(__aarch64__) || defined(__x86_64__)
# define NXT_PLATFORM_64_BIT 1
static_assert(sizeof(sizeof(char)) == 8, "Expect sizeof(size_t) == 8");
#elif defined(_WIN32) || defined(__i386__) || defined(__arm__)
# define NXT_PLATFORM_32_BIT 1
static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4");
#else
# error "Unsupported platform"
#endif
#endif // COMMON_PLATFORM_H_ #endif // COMMON_PLATFORM_H_