From b712b6f9a518901f587f63f8f58dbe26e42838a1 Mon Sep 17 00:00:00 2001 From: Alex Huszagh Date: Mon, 24 May 2021 11:37:38 -0500 Subject: [PATCH] Add support for other architectures. --- include/fast_float/float_common.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 801bf11..0368843 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -17,7 +17,18 @@ || defined(__MINGW32__)) #define FASTFLOAT_32BIT #else -#error Unknown platform (not 32-bit, not 64-bit?) + // Need to check incrementally, since SIZE_MAX is a size_t, avoid overflow. + // We can never tell the register width, but the SIZE_MAX is a good approximation. + // UINTPTR_MAX and INTPTR_MAX are optional, so avoid them for max portability. + #if SIZE_MAX == 0xffff + #error Unknown platform (16-bit, unsupported) + #elif SIZE_MAX == 0xffffffff + #define FASTFLOAT_32BIT + #elif SIZE_MAX == 0xffffffffffffffff + #define FASTFLOAT_64BIT + #else + #error Unknown platform (not 32-bit, not 64-bit?) + #endif #endif #if ((defined(_WIN32) || defined(_WIN64)) && !defined(__clang__))