From 1bb616e1ec8a6112464df475d0136427a252ca4a Mon Sep 17 00:00:00 2001 From: beerpsi Date: Mon, 1 Jan 2024 17:03:20 +0700 Subject: [PATCH] use a standard way to determine 32-bit/64-bit environment --- chuniio/src/arch.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/chuniio/src/arch.h b/chuniio/src/arch.h index 697f2aa..706dae4 100644 --- a/chuniio/src/arch.h +++ b/chuniio/src/arch.h @@ -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 -#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