fixing support for pre-C++17

This commit is contained in:
Daniel Lemire
2025-11-01 17:28:17 -04:00
parent 3319815e25
commit ccac6403d9
4 changed files with 10 additions and 9 deletions
+5
View File
@@ -13,6 +13,11 @@
#endif
#endif
// C++ 26
#if !defined(SIMDJSON_CPLUSPLUS26) && (SIMDJSON_CPLUSPLUS >= 202402L) // update when the standard is finalized
#define SIMDJSON_CPLUSPLUS26 1
#endif
// C++ 23
#if !defined(SIMDJSON_CPLUSPLUS23) && (SIMDJSON_CPLUSPLUS >= 202302L)
#define SIMDJSON_CPLUSPLUS23 1
+2 -2
View File
@@ -167,7 +167,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
// with a returned value of type value128 with a "low component" corresponding to the
// 64-bit least significant bits of the product and with a "high component" corresponding
// to the 64-bit most significant bits of the product.
#if SIMDJSON_CPLUSPLUS17
#if SIMDJSON_CPLUSPLUS26
simdjson::internal::value128 firstproduct = full_multiplication(i, simdjson::internal::powers_template<>::power_of_five_128[index]);
#else
simdjson::internal::value128 firstproduct = full_multiplication(i, simdjson::internal::power_of_five_128[index]);
@@ -205,7 +205,7 @@ simdjson_inline bool compute_float_64(int64_t power, uint64_t i, bool negative,
// with a returned value of type value128 with a "low component" corresponding to the
// 64-bit least significant bits of the product and with a "high component" corresponding
// to the 64-bit most significant bits of the product.
#if SIMDJSON_CPLUSPLUS17
#if SIMDJSON_CPLUSPLUS26
simdjson::internal::value128 secondproduct = full_multiplication(i, simdjson::internal::powers_template<>::power_of_five_128[index + 1]);
#else
simdjson::internal::value128 secondproduct = full_multiplication(i, simdjson::internal::power_of_five_128[index + 1]);
@@ -53,7 +53,7 @@ extern SIMDJSON_DLLIMPORTEXPORT const double power_of_ten[];
// The mantissa is truncated to 128 bits, and
// never rounded up. Uses about 10KB.
// We use the template trick to allow inclusion in multiple translation units.
#if SIMDJSON_CPLUSPLUS17
#if SIMDJSON_CPLUSPLUS26
template <typename unused = void> struct powers_template {
constexpr static uint64_t power_of_five_128[651*2]= {
0xeef453d6923bd65a,0x113faa2906a13b3f,
@@ -708,9 +708,9 @@ constexpr static uint64_t power_of_five_128[651*2]= {
0xe3d8f9e563a198e5,0x58180fddd97723a6,
0x8e679c2f5e44ff8f,0x570f09eaa7ea7648,};
};
#else
#endif // SIMDJSON_CPLUSPLUS26
extern SIMDJSON_DLLIMPORTEXPORT const uint64_t power_of_five_128[651*2];
#endif
} // namespace internal
} // namespace simdjson
-4
View File
@@ -20,9 +20,6 @@ SIMDJSON_DLLIMPORTEXPORT const double simdjson::internal::power_of_ten[] = {
* exactly using the binary notation, only the powers of five
* affect the binary significand.
*/
#if SIMDJSON_CPLUSPLUS17
// See header file. We use the template trick to allow inclusion in multiple translation units.
#else
// The truncated powers of five from 5^-342 all the way to 5^308
// The mantissa is truncated to 128 bits, and
// never rounded up. Uses about 10KB.
@@ -678,7 +675,6 @@ SIMDJSON_DLLIMPORTEXPORT const uint64_t simdjson::internal::power_of_five_128[]=
0xb6472e511c81471d,0xe0133fe4adf8e952,
0xe3d8f9e563a198e5,0x58180fddd97723a6,
0x8e679c2f5e44ff8f,0x570f09eaa7ea7648,};
#endif // SIMDJSON_CPLUSPLUS17
#endif // SIMDJSON_SRC_NUMBERPARSING_TABLES_CPP