4141#define SIMDJSON_IS_ARM64 1
4242#else
4343#define SIMDJSON_IS_32BITS 1
44+
45+ // We do not support 32-bit platforms, but it can be
46+ // handy to identify them.
47+ #if defined(_M_IX86) || defined(__i386__)
48+ #define SIMDJSON_IS_X86_32BITS 1
49+ #elif defined(__arm__) || defined(_M_ARM)
50+ #define SIMDJSON_IS_ARM_32BITS 1
4451#endif
4552
53+ #endif // defined(__x86_64__) || defined(_M_AMD64)
54+
4655#ifdef SIMDJSON_IS_32BITS
47- #if defined(SIMDJSON_REGULAR_VISUAL_STUDIO) || defined(__GNUC__)
48- #pragma message("The simdjson library is designed\
49- for 64 -bit processors and it seems that you are not \
56+ #pragma message("The simdjson library is designed \
57+ for 64 -bit processors and it seems that you are not \
5058compiling for a known 64 -bit platform. All fast kernels \
5159will be disabled and performance may be poor. Please \
5260use a 64 -bit target such as x64 or 64 -bit ARM." )
53- #else
54- #error " The simdjson library is designed\
55- for 64 -bit processors. It seems that you are not \
56- compiling for a known 64 -bit platform."
57- #endif
5861#endif // SIMDJSON_IS_32BITS
5962
6063// this is almost standard?
@@ -75,6 +78,15 @@ compiling for a known 64-bit platform."
7578#define SIMDJSON_IMPLEMENTATION_WESTMERE 0
7679#endif // SIMDJSON_IS_ARM64
7780
81+ // Our fast kernels require 64-bit systems.
82+ //
83+ // On 32-bit x86, we lack 64-bit popcnt, lzcnt, blsr instructions.
84+ // Furthermore, the number of SIMD registers is reduced.
85+ //
86+ // On 32-bit ARM, we would have smaller registers.
87+ //
88+ // The simdjson users should still have the fallback kernel. It is
89+ // slower, but it should run everywhere.
7890#if SIMDJSON_IS_X86_64
7991#ifndef SIMDJSON_IMPLEMENTATION_HASWELL
8092#define SIMDJSON_IMPLEMENTATION_HASWELL 1
@@ -85,7 +97,7 @@ compiling for a known 64-bit platform."
8597#define SIMDJSON_IMPLEMENTATION_ARM64 0
8698#endif // SIMDJSON_IS_X86_64
8799
88- // we are going to use runtime dispatch
100+ // We are going to use runtime dispatch.
89101#ifdef SIMDJSON_IS_X86_64
90102#ifdef __clang__
91103// clang does not have GCC push pop
0 commit comments