use a standard way to determine 32-bit/64-bit environment

This commit is contained in:
beerpsi 2024-01-01 17:03:20 +07:00
parent db9ac578e3
commit 1bb616e1ec

View File

@ -5,20 +5,14 @@
#ifndef BROKENITHM_ARCH_H
#define BROKENITHM_ARCH_H
#if _WIN32 || _WIN64
#if _WIN64
#define ENV64BIT
#else
#define ENV32BIT
#endif // _WIN64
#endif // _WIN32 || _WIN64
#include <stdint.h>
#if __GNUC__
#if __x86_64__ || __ppc64__
#define ENV64BIT
#if UINTPTR_MAX == UINT32_MAX
#define ENV32BIT
#elif UINTPTR_MAX == UINT64_MAX
#define ENV64BIT
#else
#define ENV32BIT
#endif // __x86_64__ || __ppc64__
#error "Environment is neither 32-bit nor 64-bit."
#endif
#endif // BROKENITHM_ARCH_H