Compare commits

..

4 Commits

Author SHA1 Message Date
Daniel Lemire 1f369ef210 minor patch which allows us to pass mutable strings to simdjson::from… (#2448)
* minor patch which allows us to pass mutable strings to simdjson::from and fix
an issue with ambiguous integrals

* compatibility patch.
2025-09-15 22:22:25 -06:00
Daniel Lemire 22dcdc9f1e Update README.md 2025-09-15 18:52:15 -06:00
Dirk Stolle dda2dafa30 fix some typos (#2446) 2025-09-15 18:23:13 -06:00
Daniel Lemire 72e9d44e10 fixing indent 2025-09-15 17:08:12 -06:00
39 changed files with 243 additions and 623 deletions
-1
View File
@@ -88,7 +88,6 @@ objs
# Build outputs # Build outputs
/build*/ /build*/
/visual_studio/ /visual_studio/
/originbuild/
# Fuzzer outputs generated by instructions in fuzz/Fuzzing.md # Fuzzer outputs generated by instructions in fuzz/Fuzzing.md
/corpus.zip /corpus.zip
+1 -1
View File
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14)
project( project(
simdjson simdjson
# The version number is modified by tools/release.py # The version number is modified by tools/release.py
VERSION 4.0.2 VERSION 4.0.3
DESCRIPTION "Parsing gigabytes of JSON per second" DESCRIPTION "Parsing gigabytes of JSON per second"
HOMEPAGE_URL "https://simdjson.org/" HOMEPAGE_URL "https://simdjson.org/"
LANGUAGES CXX C LANGUAGES CXX C
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = simdjson
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = "4.0.2" PROJECT_NUMBER = "4.0.3"
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
+2 -1
View File
@@ -117,9 +117,10 @@ Godbolt
------------- -------------
Some users may want to browse code along with the compiled assembly. You want to check out the following lists of examples: Some users may want to browse code along with the compiled assembly. You want to check out the following lists of examples:
* [C++26 reflection example](https://godbolt.org/z/K3Px64TqK)
* [simdjson examples with errors handled through exceptions](https://godbolt.org/z/7G5qE4sr9) * [simdjson examples with errors handled through exceptions](https://godbolt.org/z/7G5qE4sr9)
* [simdjson examples with errors without exceptions](https://godbolt.org/z/e9dWb9E4v) * [simdjson examples with errors without exceptions](https://godbolt.org/z/e9dWb9E4v)
* [C++26 reflection example](https://godbolt.org/z/xK5TGKdPb)
Performance results Performance results
------------------- -------------------
+5 -1
View File
@@ -6,8 +6,9 @@ CPMAddPackage(
EXCLUDE_FROM_ALL YES EXCLUDE_FROM_ALL YES
) )
option(SIMDJSON_USE_RUST "Build the static_reflect benchmark" OFF)
if(SIMDJSON_USER_RUST)
if(NOT WIN32) if(NOT WIN32)
# We want the check whether Rust is available before trying to build a crate. # We want the check whether Rust is available before trying to build a crate.
CPMAddPackage( CPMAddPackage(
@@ -38,6 +39,9 @@ else()
message(STATUS "curl https://sh.rustup.rs -sSf | sh") message(STATUS "curl https://sh.rustup.rs -sSf | sh")
endif() endif()
endif() endif()
else(SIMDJSON_USER_RUST)
message(STATUS "We will not benchmark serde-benchmark." )
endif(SIMDJSON_USER_RUST)
# Add the benchmark executable targets # Add the benchmark executable targets
add_subdirectory(twitter_benchmark) add_subdirectory(twitter_benchmark)
+2 -2
View File
@@ -1,7 +1,7 @@
# #
# Implementation selection # Implementation selection
# #
set(SIMDJSON_ALL_IMPLEMENTATIONS fallback westmere haswell icelake arm64 ppc64 rvv) set(SIMDJSON_ALL_IMPLEMENTATIONS fallback westmere haswell icelake arm64 ppc64)
set( set(
SIMDJSON_IMPLEMENTATION "" SIMDJSON_IMPLEMENTATION ""
@@ -15,7 +15,7 @@ set(
SIMDJSON_EXCLUDE_IMPLEMENTATION "" SIMDJSON_EXCLUDE_IMPLEMENTATION ""
CACHE STRING "\ CACHE STRING "\
Semicolon-separated list of implementations to exclude \ Semicolon-separated list of implementations to exclude \
(icelake/haswell/westmere/arm64/ppc64/rvv/fallback). By default, excludes any \ (icelake/haswell/westmere/arm64/ppc64/fallback). By default, excludes any \
implementations that are unsupported at compile time or cannot be selected at \ implementations that are unsupported at compile time or cannot be selected at \
runtime." runtime."
) )
+2 -2
View File
@@ -1395,7 +1395,7 @@ Car c = doc.get<Car>();
We try to automate the parsing of any given structure or class We try to automate the parsing of any given structure or class
by looking at its non-static public members. At compile-time, by looking at its non-static public members. At compile-time,
the library looks at a simple structre like `Car` and the library looks at a simple structure like `Car` and
maps it to parsing code. We call the default constructor, maps it to parsing code. We call the default constructor,
and then assign values to the public members. and then assign values to the public members.
@@ -1450,7 +1450,7 @@ struct complicated_weather_data {
}; };
``` ```
The code might as simple as the following. The code might be as simple as the following.
```cpp ```cpp
auto padded = R"({"time":["2023-03-15T12:00:00Z"],"temperature":[42]})"_padded; auto padded = R"({"time":["2023-03-15T12:00:00Z"],"temperature":[42]})"_padded;
+1 -1
View File
@@ -41,7 +41,7 @@ Parameters:
- `append_raw(std::string_view input)`: Appends a string view directly to the JSON buffer without escaping. - `append_raw(std::string_view input)`: Appends a string view directly to the JSON buffer without escaping.
- `append_raw(const char *str, size_t len)`: Appends a specified number of characters from a C string directly to the JSON - `append_raw(const char *str, size_t len)`: Appends a specified number of characters from a C string directly to the JSON
After writting the content, if you have reasons to believe that the content might violate UTF-8 conventions, you can check it as follows: After writing the content, if you have reasons to believe that the content might violate UTF-8 conventions, you can check it as follows:
- `validate_unicode()`: Checks if the content in the JSON buffer is valid UTF-8. Returns: true if the content is valid UTF-8, false otherwise. - `validate_unicode()`: Checks if the content in the JSON buffer is valid UTF-8. Returns: true if the content is valid UTF-8, false otherwise.
+1 -1
View File
@@ -129,7 +129,7 @@ Once you have an element, you can navigate it with idiomatic C++ iterators, oper
The strings contain unescaped valid UTF-8 strings: no unmatched surrogate is allowed. The strings contain unescaped valid UTF-8 strings: no unmatched surrogate is allowed.
Internally, numbers are stored as either 64-bit integers or 64-bit floating-point numbers. Internally, numbers are stored as either 64-bit integers or 64-bit floating-point numbers.
Thus it is possible to get the full 64-bit integer range (either signed or unsigned). Thus it is possible to get the full 64-bit integer range (either signed or unsigned).
By default, the string `-0` is parsed as the integer 0 as in Pytho or C++. If you set the macro By default, the string `-0` is parsed as the integer 0 as in Python or C++. If you set the macro
`SIMDJSON_MINUS_ZERO_AS_FLOAT` to `1` when building simdjson, you can get that `-0` is mapped to `-0.0` `SIMDJSON_MINUS_ZERO_AS_FLOAT` to `1` when building simdjson, you can get that `-0` is mapped to `-0.0`
as in JavaScript. You can get the desired effect by building simdjson with cmake setting the as in JavaScript. You can get the desired effect by building simdjson with cmake setting the
`SIMDJSON_MINUS_ZERO_AS_FLOAT` to on: `cmake -B build -D SIMDJSON_MINUS_ZERO_AS_FLOAT=ON`. `SIMDJSON_MINUS_ZERO_AS_FLOAT` to on: `cmake -B build -D SIMDJSON_MINUS_ZERO_AS_FLOAT=ON`.
-2
View File
@@ -24,8 +24,6 @@
#include "simdjson/lsx.h" #include "simdjson/lsx.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx) #elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
#include "simdjson/lasx.h" #include "simdjson/lasx.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(rvv)
#include "simdjson/rvv.h"
#else #else
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION #error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
#endif #endif
-2
View File
@@ -21,8 +21,6 @@ namespace simdjson {
namespace lsx {} namespace lsx {}
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx) #elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
namespace lasx {} namespace lasx {}
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(rvv)
namespace rvv {}
#else #else
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION #error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
#endif #endif
@@ -23,8 +23,6 @@
#include "simdjson/lsx/implementation.h" #include "simdjson/lsx/implementation.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx) #elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
#include "simdjson/lasx/implementation.h" #include "simdjson/lasx/implementation.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(rvv)
#include "simdjson/rvv/implementation.h"
#else #else
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION #error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
#endif #endif
-2
View File
@@ -24,8 +24,6 @@
#include "simdjson/lsx/ondemand.h" #include "simdjson/lsx/ondemand.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx) #elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
#include "simdjson/lasx/ondemand.h" #include "simdjson/lasx/ondemand.h"
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(rvv)
#include "simdjson/rvv/ondemand.h"
#else #else
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION #error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
#endif #endif
+10
View File
@@ -116,6 +116,16 @@ template <typename T>
inline auto to_adaptor<T>::operator()(ondemand::parser &parser, padded_string_view const str) const noexcept { inline auto to_adaptor<T>::operator()(ondemand::parser &parser, padded_string_view const str) const noexcept {
return auto_parser<ondemand::parser *>{parser, str}; return auto_parser<ondemand::parser *>{parser, str};
} }
template <typename T>
inline auto to_adaptor<T>::operator()(std::string str) const noexcept {
return auto_parser{pad_with_reserve(str)};
}
template <typename T>
inline auto to_adaptor<T>::operator()(ondemand::parser &parser, std::string str) const noexcept {
return auto_parser<ondemand::parser *>{parser, pad_with_reserve(str)};
}
} // namespace internal } // namespace internal
} // namespace convert } // namespace convert
} // namespace simdjson } // namespace simdjson
+5
View File
@@ -72,6 +72,11 @@ struct to_adaptor {
T operator()(simdjson_result<ondemand::value> &val) const noexcept; T operator()(simdjson_result<ondemand::value> &val) const noexcept;
auto operator()(padded_string_view const str) const noexcept; auto operator()(padded_string_view const str) const noexcept;
auto operator()(ondemand::parser &parser, padded_string_view const str) const noexcept; auto operator()(ondemand::parser &parser, padded_string_view const str) const noexcept;
// The std::string is padded with reserve to ensure there is enough space for padding.
// Some sanitizers may not like this, so you can use simdjson::pad instead.
// simdjson::from(simdjson::pad(str))
auto operator()(std::string str) const noexcept;
auto operator()(ondemand::parser &parser, std::string str) const noexcept;
}; };
} // namespace internal } // namespace internal
} // namespace convert } // namespace convert
@@ -284,10 +284,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -299,9 +301,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -332,7 +333,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
+1 -13
View File
@@ -12,7 +12,6 @@
#define SIMDJSON_IMPLEMENTATION_ID_westmere 6 #define SIMDJSON_IMPLEMENTATION_ID_westmere 6
#define SIMDJSON_IMPLEMENTATION_ID_lsx 7 #define SIMDJSON_IMPLEMENTATION_ID_lsx 7
#define SIMDJSON_IMPLEMENTATION_ID_lasx 8 #define SIMDJSON_IMPLEMENTATION_ID_lasx 8
#define SIMDJSON_IMPLEMENTATION_ID_rvv 9
#define SIMDJSON_IMPLEMENTATION_ID_FOR(IMPL) SIMDJSON_CAT(SIMDJSON_IMPLEMENTATION_ID_, IMPL) #define SIMDJSON_IMPLEMENTATION_ID_FOR(IMPL) SIMDJSON_CAT(SIMDJSON_IMPLEMENTATION_ID_, IMPL)
#define SIMDJSON_IMPLEMENTATION_ID SIMDJSON_IMPLEMENTATION_ID_FOR(SIMDJSON_IMPLEMENTATION) #define SIMDJSON_IMPLEMENTATION_ID SIMDJSON_IMPLEMENTATION_ID_FOR(SIMDJSON_IMPLEMENTATION)
@@ -24,15 +23,6 @@
// in which we include them. // in which we include them.
// //
#ifndef SIMDJSON_IMPLEMENTATION_RVV
#define SIMDJSON_IMPLEMENTATION_RVV (SIMDJSON_IS_RISCV64 && SIMDJSON_IS_RVV)
#endif
#if SIMDJSON_IMPLEMENTATION_RVV && SIMDJSON_IS_RISCV64 && SIMDJSON_IS_RVV
#define SIMDJSON_CAN_ALWAYS_RUN_RVV 1
#else
#define SIMDJSON_CAN_ALWAYS_RUN_RVV 0
#endif
#ifndef SIMDJSON_IMPLEMENTATION_ARM64 #ifndef SIMDJSON_IMPLEMENTATION_ARM64
#define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64) #define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64)
#endif #endif
@@ -138,7 +128,7 @@
// Default Fallback to on unless a builtin implementation has already been selected. // Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDJSON_IMPLEMENTATION_FALLBACK #ifndef SIMDJSON_IMPLEMENTATION_FALLBACK
#if SIMDJSON_CAN_ALWAYS_RUN_ARM64 || SIMDJSON_CAN_ALWAYS_RUN_ICELAKE || SIMDJSON_CAN_ALWAYS_RUN_HASWELL || SIMDJSON_CAN_ALWAYS_RUN_WESTMERE || SIMDJSON_CAN_ALWAYS_RUN_PPC64 || SIMDJSON_CAN_ALWAYS_RUN_LSX || SIMDJSON_CAN_ALWAYS_RUN_LASX || SIMDJSON_CAN_ALWAYS_RUN_RVV #if SIMDJSON_CAN_ALWAYS_RUN_ARM64 || SIMDJSON_CAN_ALWAYS_RUN_ICELAKE || SIMDJSON_CAN_ALWAYS_RUN_HASWELL || SIMDJSON_CAN_ALWAYS_RUN_WESTMERE || SIMDJSON_CAN_ALWAYS_RUN_PPC64 || SIMDJSON_CAN_ALWAYS_RUN_LSX || SIMDJSON_CAN_ALWAYS_RUN_LASX
// if anything at all except fallback can always run, then disable fallback. // if anything at all except fallback can always run, then disable fallback.
#define SIMDJSON_IMPLEMENTATION_FALLBACK 0 #define SIMDJSON_IMPLEMENTATION_FALLBACK 0
#else #else
@@ -164,8 +154,6 @@
#define SIMDJSON_BUILTIN_IMPLEMENTATION lsx #define SIMDJSON_BUILTIN_IMPLEMENTATION lsx
#elif SIMDJSON_CAN_ALWAYS_RUN_LASX #elif SIMDJSON_CAN_ALWAYS_RUN_LASX
#define SIMDJSON_BUILTIN_IMPLEMENTATION lasx #define SIMDJSON_BUILTIN_IMPLEMENTATION lasx
#elif SIMDJSON_CAN_ALWAYS_RUN_RVV
#define SIMDJSON_BUILTIN_IMPLEMENTATION rvv
#elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK #elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK
#define SIMDJSON_BUILTIN_IMPLEMENTATION fallback #define SIMDJSON_BUILTIN_IMPLEMENTATION fallback
#else #else
-8
View File
@@ -1,8 +0,0 @@
#ifndef SIMDJSON_RVV_H
#define SIMDJSON_RVV_H
#include "simdjson/rvv/begin.h"
#include "simdjson/generic/amalgamated.h"
#include "simdjson/rvv/end.h"
#endif // SIMDJSON_RVV_H
-20
View File
@@ -1,20 +0,0 @@
#ifndef SIMDJSON_RVV_BASE_H
#define SIMDJSON_RVV_BASE_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/base.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace rvv {
class implementation;
namespace {
namespace simd {
template <typename T> struct simd8;
template <typename T> struct simd8x64;
} // namespace simd
} // unnamed namespace
} // namespace rvv
} // namespace simdjson
#endif // SIMDJSON_RVV_BASE_H
-13
View File
@@ -1,13 +0,0 @@
#define SIMDJSON_IMPLEMENTATION rvv
// include RVV intrinsics and definitions
#include <riscv_vector.h>
#include "simdjson/rvv/base.h"
#include "simdjson/rvv/intrinsics.h"
#include "simdjson/rvv/bitmanipulation.h"
#include "simdjson/rvv/bitmask.h"
#include "simdjson/rvv/numberparsing_defs.h"
#include "simdjson/rvv/simd.h"
#include "simdjson/rvv/stringparsing_defs.h"
#define SIMDJSON_SKIP_BACKSLASH_SHORT_CIRCUIT 1
-54
View File
@@ -1,54 +0,0 @@
#ifndef SIMDJSON_RVV_BITMANIPULATION_H
#define SIMDJSON_RVV_BITMANIPULATION_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/rvv/base.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace rvv {
namespace {
/* result might be undefined when input_num is zero */
simdjson_inline int leading_zeroes(uint64_t input_num) {
#if defined(_MSC_VER) && !defined(__clang__)
unsigned long leading_zero = 0;
if (_BitScanReverse64(&leading_zero, input_num))
return (int)(63 - leading_zero);
else
return 64;
#else
return __builtin_clzll(input_num);
#endif
}
simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) {
return input_num & (input_num - 1);
}
simdjson_inline int count_ones(uint64_t input_num) {
return __builtin_popcountll(input_num);
}
inline simdjson::internal::value128 full_multiplication(uint64_t a, uint64_t b) {
#if __SIZEOF_INT128__
unsigned __int128 p = (unsigned __int128)a * b;
return { (uint64_t)p, (uint64_t)(p >> 64) };
#else
uint64_t lo = a * b;
uint64_t a0 = (uint32_t)a, a1 = a >> 32;
uint64_t b0 = (uint32_t)b, b1 = b >> 32;
uint64_t mid1 = a0 * b1;
uint64_t mid2 = a1 * b0;
uint64_t carry = ((mid1 & 0xFFFFFFFF) + (mid2 & 0xFFFFFFFF) + (lo >> 32)) >> 32;
uint64_t hi = a1 * b1 + (mid1 >> 32) + (mid2 >> 32) + carry;
return { lo, hi };
#endif
}
} // unnamed namespace
} // namespace rvv
} // namespace simdjson
#endif // SIMDJSON_RVV_BITMANIPULATION_H
View File
-6
View File
@@ -1,6 +0,0 @@
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/rvv/base.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
#undef SIMDJSON_SKIP_BACKSLASH_SHORT_CIRCUIT
#undef SIMDJSON_IMPLEMENTATION
-29
View File
@@ -1,29 +0,0 @@
#ifndef SIMDJSON_RVV_IMPLEMENTATION_H
#define SIMDJSON_RVV_IMPLEMENTATION_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#define SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace rvv {
class implementation final: public simdjson::implementation {
public:
simdjson_inline implementation() : simdjson::implementation("rvv", "RISC-V Vector Extension", 0) {}
simdjson_warn_unused error_code create_dom_parser_implementation(
size_t capacity,
size_t max_depth,
std::unique_ptr<internal::dom_parser_implementation>& dst
) const noexcept final;
simdjson_warn_unused error_code minify(const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept final;
simdjson_warn_unused bool validate_utf8(const char *buf, size_t len) const noexcept final;
};
} // namespace rvv
} // namespace simdjson
#endif // SIMDJSON_RVV_IMPLEMENTATION_H
-8
View File
@@ -1,8 +0,0 @@
#ifndef SIMDJSON_RVV_INTRINSICS_H
#define SIMDJSON_RVV_INTRINSICS_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/rvv/base.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
#endif // SIMDJSON_RVV_INTRINSICS_H
-9
View File
@@ -1,9 +0,0 @@
#ifndef SIMDJSON_RVV_ONDEMAND_H
#define SIMDJSON_RVV_ONDEMAND_H
#include "simdjson/rvv/begin.h"
#include "simdjson/generic/ondemand/amalgamated.h"
#include "simdjson/rvv/end.h"
#endif // SIMDJSON_RVV_ONDEMAND_H
-298
View File
@@ -1,298 +0,0 @@
#ifndef SIMDJSON_RVV_SIMD_H
#define SIMDJSON_RVV_SIMD_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include "simdjson/rvv/base.h"
#include "simdjson/rvv/intrinsics.h"
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace rvv {
namespace {
namespace simd {
// ---------- 128-bit fixed vectors ----------
using vuint8x16 = vuint8m1_t __attribute__((riscv_rvv_vector_bits(128)));
using vint8x16 = vint8m1_t __attribute__((riscv_rvv_vector_bits(128)));
using vbool8x16 = vbool8_t;
static constexpr size_t fixed_vl = 16;
// ---------- forward ----------
template<typename T> struct simd8;
template<typename T> struct simd8x64;
// ---------- base<Child> ----------
template<typename Child>
struct base {
vuint8x16 value{};
base() = default;
base(vuint8x16 v) : value(v) {}
operator vuint8x16() const { return value; }
operator vuint8x16&() { return value; }
simdjson_inline Child operator|(const Child o) const { return __riscv_vor_vv_u8m1(value, o, fixed_vl); }
simdjson_inline Child operator&(const Child o) const { return __riscv_vand_vv_u8m1(value, o, fixed_vl); }
simdjson_inline Child operator^(const Child o) const { return __riscv_vxor_vv_u8m1(value, o, fixed_vl); }
simdjson_inline Child bit_andnot(const Child o) const { return __riscv_vandn_vv_u8m1(value, o, fixed_vl); }
simdjson_inline Child& operator|=(const Child o) { auto* c = static_cast<Child*>(this); *c = *c | o; return *c; }
simdjson_inline Child& operator&=(const Child o) { auto* c = static_cast<Child*>(this); *c = *c & o; return *c; }
simdjson_inline Child& operator^=(const Child o) { auto* c = static_cast<Child*>(this); *c = *c ^ o; return *c; }
};
// ---------- base8<T,Mask> ----------
template<typename T, typename Mask = simd8<bool>>
struct base8 : base<simd8<T>> {
using base<simd8<T>>::value;
using bitmask_t = uint32_t;
base8() = default;
base8(vuint8x16 v) : base<simd8<T>>(v) {}
friend simdjson_inline Mask operator==(const simd8<T> a, const simd8<T> b) {
return simd8<bool>(__riscv_vmseq_vv_u8m1_b8(a, b, fixed_vl));
}
template<int N=1>
simdjson_inline simd8<T> prev(const simd8<T> prev_chunk) const {
return __riscv_vslideup_vx_u8m1(prev_chunk, value, fixed_vl - N, 2 * fixed_vl);
}
};
// ---------- simd8<bool> ----------
template<>
struct simd8<bool> : base8<bool> {
simd8() = default;
simd8(vuint8x16 v) : base8(v) {}
simd8(vbool8_t m) : base8(__riscv_vmerge_vvm_u8m1(
__riscv_vmv_v_x_u8m1(0, fixed_vl),
__riscv_vmv_v_x_u8m1(0xFFu, fixed_vl),
m, fixed_vl)) {}
static simdjson_inline simd8<bool> splat(bool b) {
return __riscv_vmv_v_x_u8m1(uint8_t(-b), fixed_vl);
}
simdjson_inline simd8(bool b) : simd8(splat(b)) {}
simdjson_inline int to_bitmask() const {
vuint8x16 bits = __riscv_vand_vx_u8m1(value, 0xFFu, fixed_vl);
vbool8x16 mask = __riscv_vmseq_vx_u8m1_b8(bits, 0xFFu, fixed_vl);
return __riscv_vcpop_m_b8(mask, fixed_vl);
}
simdjson_inline bool any_bits_set_anywhere() const {
return to_bitmask() != 0;
}
simdjson_inline simd8<bool> operator~() const { return *this ^ splat(true); }
};
// ---------- simd8<uint8_t> ----------
template<>
struct simd8<uint8_t> : base8<uint8_t> {
simd8() = default;
simd8(vuint8x16 v) : base8(v) {}
static simdjson_inline simd8<uint8_t> splat(uint8_t v) {
return __riscv_vmv_v_x_u8m1(v, fixed_vl);
}
static simdjson_inline simd8<uint8_t> zero() { return splat(0); }
static simdjson_inline simd8<uint8_t> load(const uint8_t* p) {
return __riscv_vle8_v_u8m1(p, fixed_vl);
}
simdjson_inline simd8(uint8_t v) : simd8(splat(v)) {}
simdjson_inline simd8(const uint8_t* p) : simd8(load(p)) {}
simdjson_inline void store(uint8_t* p) const {
__riscv_vse8_v_u8m1(p, value, fixed_vl);
}
simdjson_inline simd8<uint8_t> operator+(const simd8<uint8_t> o) const {
return __riscv_vadd_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<uint8_t> operator-(const simd8<uint8_t> o) const {
return __riscv_vsub_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<uint8_t>& operator+=(const simd8<uint8_t> o) {
*this = *this + o; return *this;
}
simdjson_inline simd8<uint8_t>& operator-=(const simd8<uint8_t> o) {
*this = *this - o; return *this;
}
simdjson_inline simd8<uint8_t> saturating_add(const simd8<uint8_t> o) const {
return __riscv_vsaddu_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<uint8_t> saturating_sub(const simd8<uint8_t> o) const {
return __riscv_vssubu_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<uint8_t> max_val(const simd8<uint8_t> o) const {
return __riscv_vmaxu_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<uint8_t> min_val(const simd8<uint8_t> o) const {
return __riscv_vminu_vv_u8m1(value, o, fixed_vl);
}
simdjson_inline simd8<bool> operator>(const simd8<uint8_t> o) const {
return simd8<bool>(__riscv_vmsgtu_vv_u8m1_b8(value, o, fixed_vl));
}
simdjson_inline simd8<bool> operator<(const simd8<uint8_t> o) const {
return simd8<bool>(__riscv_vmsgtu_vv_u8m1_b8(o, value, fixed_vl));
}
simdjson_inline simd8<bool> operator<=(const simd8<uint8_t> o) const {
return simd8<bool>(__riscv_vmsleu_vv_u8m1_b8(value, o, fixed_vl));
}
simdjson_inline simd8<bool> operator>=(const simd8<uint8_t> o) const {
return simd8<bool>(__riscv_vmsleu_vv_u8m1_b8(o, value, fixed_vl));
}
template<int NS>
simdjson_inline simd8<uint8_t> shr() const {
return __riscv_vsrl_vx_u8m1(value, NS, fixed_vl);
}
template<int NS>
simdjson_inline simd8<uint8_t> shl() const {
return __riscv_vsll_vx_u8m1(value, NS, fixed_vl);
}
template <typename Ret>
simdjson_inline simd8<Ret> lookup_16(const Ret* table) const {
alignas(16) uint8_t idx[16];
store(idx);
alignas(16) Ret res[16];
for (int i = 0; i < 16; ++i) res[i] = table[idx[i]];
return simd8<Ret>::load(reinterpret_cast<const Ret*>(res));
}
simdjson_inline void compress(uint16_t mask, uint8_t* out) const {
alignas(16) uint8_t tmp[16];
store(tmp);
for (int i = 0, j = 0; i < 16; ++i)
if (mask & (1u << i)) out[j++] = tmp[i];
}
simdjson_inline uint64_t gt_bits(uint8_t max_value) const {
return (*this > splat(max_value)).to_bitmask();
}
simdjson_inline uint64_t gt_bits(const simd8<uint8_t>& max_vec) const {
return (*this > max_vec).to_bitmask();
}
simdjson_inline bool any_bits_set_anywhere() const {
return (*this > zero()).any_bits_set_anywhere();
}
};
// ---------- simd8<int8_t> ----------
template<>
struct simd8<int8_t> {
vint8x16 value{};
simd8() = default;
simd8(vint8x16 v) : value(v) {}
static simdjson_inline simd8<int8_t> splat(int8_t v) {
return __riscv_vmv_v_x_i8m1(v, fixed_vl);
}
static simdjson_inline simd8<int8_t> zero() { return splat(0); }
static simdjson_inline simd8<int8_t> load(const int8_t* p) {
return __riscv_vle8_v_i8m1(p, fixed_vl);
}
simdjson_inline simd8(int8_t v) : simd8(splat(v)) {}
simdjson_inline simd8(const int8_t* p) : simd8(load(p)) {}
simdjson_inline void store(int8_t* p) const {
__riscv_vse8_v_i8m1(p, value, fixed_vl);
}
simdjson_inline simd8<int8_t> operator+(const simd8<int8_t> o) const {
return __riscv_vadd_vv_i8m1(value, o.value, fixed_vl);
}
simdjson_inline simd8<int8_t> operator-(const simd8<int8_t> o) const {
return __riscv_vsub_vv_i8m1(value, o.value, fixed_vl);
}
simdjson_inline simd8<int8_t> max_val(const simd8<int8_t> o) const {
return __riscv_vmax_vv_i8m1(value, o.value, fixed_vl);
}
simdjson_inline simd8<int8_t> min_val(const simd8<int8_t> o) const {
return __riscv_vmin_vv_i8m1(value, o.value, fixed_vl);
}
simdjson_inline simd8<bool> operator>(const simd8<int8_t> o) const {
return simd8<bool>(__riscv_vmsgt_vv_i8m1_b8(value, o.value, fixed_vl));
}
simdjson_inline simd8<bool> operator<(const simd8<int8_t> o) const {
return simd8<bool>(__riscv_vmsgt_vv_i8m1_b8(o.value, value, fixed_vl));
}
simdjson_inline simd8<bool> operator==(const simd8<int8_t> o) const {
return simd8<bool>(__riscv_vmseq_vv_i8m1_b8(value, o.value, fixed_vl));
}
template<int N=1>
simdjson_inline simd8<int8_t> prev(const simd8<int8_t> prev_chunk) const {
return __riscv_vslideup_vx_i8m1(prev_chunk.value, value, fixed_vl - N, 2 * fixed_vl);
}
};
// ---------- simd8x64<T> ----------
template<typename T>
struct simd8x64 {
static constexpr int NUM_CHUNKS = 64 / sizeof(simd8<T>);
static_assert(NUM_CHUNKS == 4, "RVV kernel uses 4×128-bit chunks per 64-byte block.");
const simd8<T> chunks[4];
simd8x64(const simd8x64&) = delete;
simd8x64& operator=(const simd8x64&) = delete;
simd8x64() = delete;
simdjson_inline simd8x64(const simd8<T> c0, const simd8<T> c1,
const simd8<T> c2, const simd8<T> c3)
: chunks{c0, c1, c2, c3} {}
simdjson_inline simd8x64(const T* ptr)
: chunks{simd8<T>::load(ptr),
simd8<T>::load(ptr + 16),
simd8<T>::load(ptr + 32),
simd8<T>::load(ptr + 48)} {}
simdjson_inline void store(T* ptr) const {
chunks[0].store(ptr);
chunks[1].store(ptr + 16);
chunks[2].store(ptr + 32);
chunks[3].store(ptr + 48);
}
simdjson_inline simd8<T> reduce_or() const {
return (chunks[0] | chunks[1]) | (chunks[2] | chunks[3]);
}
simdjson_inline uint64_t to_bitmask() const {
uint16_t m0 = uint16_t(chunks[0].to_bitmask());
uint16_t m1 = uint16_t(chunks[1].to_bitmask());
uint16_t m2 = uint16_t(chunks[2].to_bitmask());
uint16_t m3 = uint16_t(chunks[3].to_bitmask());
return m0 | (uint64_t(m1) << 16) | (uint64_t(m2) << 32) | (uint64_t(m3) << 48);
}
simdjson_inline uint64_t eq(const T m) const {
simd8<T> spl = simd8<T>::splat(m);
return simd8x64<bool>(chunks[0] == spl,
chunks[1] == spl,
chunks[2] == spl,
chunks[3] == spl).to_bitmask();
}
simdjson_inline uint64_t lteq(const T m) const {
simd8<T> spl = simd8<T>::splat(m);
return simd8x64<bool>(chunks[0] <= spl,
chunks[1] <= spl,
chunks[2] <= spl,
chunks[3] <= spl).to_bitmask();
}
simdjson_inline uint64_t compress(uint64_t mask, T* out) const {
using internal::BitsSetTable256mul2;
uint32_t m0 = uint32_t(mask);
uint32_t m1 = uint32_t(mask >> 16);
uint32_t m2 = uint32_t(mask >> 32);
uint32_t m3 = uint32_t(mask >> 48);
int pop0 = BitsSetTable256mul2[uint8_t(m0)];
int pop1 = BitsSetTable256mul2[uint8_t(m1)];
int pop2 = BitsSetTable256mul2[uint8_t(m2)];
chunks[0].compress(uint16_t(m0), out);
chunks[1].compress(uint16_t(m1), out + 16 - pop0);
chunks[2].compress(uint16_t(m2), out + 32 - pop0 - pop1);
chunks[3].compress(uint16_t(m3), out + 48 - pop0 - pop1 - pop2);
return 64 - __builtin_popcountll(mask);
}
};
} // namespace simd
} // unnamed namespace
} // namespace rvv
} // namespace simdjson
#endif // SIMDJSON_RVV_SIMD_H
+2 -2
View File
@@ -4,7 +4,7 @@
#define SIMDJSON_SIMDJSON_VERSION_H #define SIMDJSON_SIMDJSON_VERSION_H
/** The version of simdjson being used (major.minor.revision) */ /** The version of simdjson being used (major.minor.revision) */
#define SIMDJSON_VERSION "4.0.2" #define SIMDJSON_VERSION "4.0.3"
namespace simdjson { namespace simdjson {
enum { enum {
@@ -19,7 +19,7 @@ enum {
/** /**
* The revision (major.minor.REVISION) of simdjson being used. * The revision (major.minor.REVISION) of simdjson being used.
*/ */
SIMDJSON_VERSION_REVISION = 2 SIMDJSON_VERSION_REVISION = 3
}; };
} // namespace simdjson } // namespace simdjson
+2 -1
View File
@@ -71,7 +71,7 @@ else:
RelativeRoot = str # Literal['src','include'] # Literal not supported in Python 3.7 (CI) RelativeRoot = str # Literal['src','include'] # Literal not supported in Python 3.7 (CI)
RELATIVE_ROOTS: List[RelativeRoot] = ['src', 'include' ] RELATIVE_ROOTS: List[RelativeRoot] = ['src', 'include' ]
Implementation = str # Literal['arm64', 'fallback', 'haswell', 'icelake', 'ppc64', 'westmere', 'lsx', 'lasx'] # Literal not supported in Python 3.7 (CI) Implementation = str # Literal['arm64', 'fallback', 'haswell', 'icelake', 'ppc64', 'westmere', 'lsx', 'lasx'] # Literal not supported in Python 3.7 (CI)
IMPLEMENTATIONS: List[Implementation] = [ 'arm64', 'haswell', 'icelake', 'lasx', 'lsx', 'ppc64', 'westmere', 'fallback', 'rvv' ] IMPLEMENTATIONS: List[Implementation] = [ 'arm64', 'haswell', 'icelake', 'lasx', 'lsx', 'ppc64', 'westmere', 'fallback' ]
GENERIC_INCLUDE = "simdjson/generic" GENERIC_INCLUDE = "simdjson/generic"
GENERIC_SRC = "generic" GENERIC_SRC = "generic"
BUILTIN = "simdjson/builtin" BUILTIN = "simdjson/builtin"
@@ -358,6 +358,7 @@ class Amalgamator:
self.include_stack.append(file) self.include_stack.append(file)
file.processed = False file.processed = False
self.write(f"/* begin file {self.file_to_str(file)} */") self.write(f"/* begin file {self.file_to_str(file)} */")
if file == BUILTIN_BEGIN_H: if file == BUILTIN_BEGIN_H:
+1 -1
View File
@@ -1,4 +1,4 @@
/* auto-generated on 2025-09-14 09:01:41 -0600. version 4.0.2 Do not edit! */ /* auto-generated on 2025-09-15 19:47:29 -0600. version 4.0.3 Do not edit! */
/* including simdjson.cpp: */ /* including simdjson.cpp: */
/* begin file simdjson.cpp */ /* begin file simdjson.cpp */
#define SIMDJSON_SRC_SIMDJSON_CPP #define SIMDJSON_SRC_SIMDJSON_CPP
+106 -51
View File
@@ -1,4 +1,4 @@
/* auto-generated on 2025-09-14 09:01:41 -0600. version 4.0.2 Do not edit! */ /* auto-generated on 2025-09-15 19:47:29 -0600. version 4.0.3 Do not edit! */
/* including simdjson.h: */ /* including simdjson.h: */
/* begin file simdjson.h */ /* begin file simdjson.h */
#ifndef SIMDJSON_H #ifndef SIMDJSON_H
@@ -2508,7 +2508,7 @@ namespace std {
#define SIMDJSON_SIMDJSON_VERSION_H #define SIMDJSON_SIMDJSON_VERSION_H
/** The version of simdjson being used (major.minor.revision) */ /** The version of simdjson being used (major.minor.revision) */
#define SIMDJSON_VERSION "4.0.2" #define SIMDJSON_VERSION "4.0.3"
namespace simdjson { namespace simdjson {
enum { enum {
@@ -2523,7 +2523,7 @@ enum {
/** /**
* The revision (major.minor.REVISION) of simdjson being used. * The revision (major.minor.REVISION) of simdjson being used.
*/ */
SIMDJSON_VERSION_REVISION = 2 SIMDJSON_VERSION_REVISION = 3
}; };
} // namespace simdjson } // namespace simdjson
@@ -45345,10 +45345,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -45360,9 +45362,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -45393,7 +45394,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -58304,10 +58309,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -58319,9 +58326,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -58352,7 +58358,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -71762,10 +71772,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -71777,9 +71789,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -71810,7 +71821,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -85220,10 +85235,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -85235,9 +85252,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -85268,7 +85284,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -98793,10 +98813,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -98808,9 +98830,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -98841,7 +98862,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -112682,10 +112707,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -112697,9 +112724,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -112730,7 +112756,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -126048,10 +126078,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -126063,9 +126095,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -126096,7 +126127,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -139427,10 +139462,12 @@ simdjson_inline void string_builder::clear() noexcept {
namespace internal { namespace internal {
// We could specialize further for 32-bit integers.
simdjson_really_inline int int_log2(uint32_t x) { return (63 - leading_zeroes(x | 1)); }
simdjson_really_inline int fast_digit_count(uint32_t x) { template <typename number_type, typename = typename std::enable_if<
std::is_unsigned<number_type>::value>::type>
simdjson_really_inline int int_log2(number_type x) { return 63 - leading_zeroes(uint64_t(x) | 1); }
simdjson_really_inline int fast_digit_count_32(uint32_t x) {
static uint64_t table[] = { static uint64_t table[] = {
4294967296, 8589934582, 8589934582, 8589934582, 12884901788, 4294967296, 8589934582, 8589934582, 8589934582, 12884901788,
12884901788, 12884901788, 17179868184, 17179868184, 17179868184, 12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
@@ -139442,9 +139479,8 @@ simdjson_really_inline int fast_digit_count(uint32_t x) {
return uint32_t((x + table[int_log2(x)]) >> 32); return uint32_t((x + table[int_log2(x)]) >> 32);
} }
simdjson_really_inline int int_log2(uint64_t x) { return 63 - leading_zeroes(x | 1); }
simdjson_really_inline int fast_digit_count(uint64_t x) { simdjson_really_inline int fast_digit_count_64(uint64_t x) {
static uint64_t table[] = {9, static uint64_t table[] = {9,
99, 99,
999, 999,
@@ -139475,7 +139511,11 @@ simdjson_really_inline size_t digit_count(number_type v) noexcept {
static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 || static_assert(sizeof(number_type) == 8 || sizeof(number_type) == 4 ||
sizeof(number_type) == 2 || sizeof(number_type) == 1, sizeof(number_type) == 2 || sizeof(number_type) == 1,
"We only support 8-bit, 16-bit, 32-bit and 64-bit numbers"); "We only support 8-bit, 16-bit, 32-bit and 64-bit numbers");
return fast_digit_count(v); SIMDJSON_IF_CONSTEXPR(sizeof(number_type) <= 4) {
return fast_digit_count_32(static_cast<uint32_t>(v));
} else {
return fast_digit_count_64(static_cast<uint64_t>(v));
}
} }
static const char decimal_table[200] = { static const char decimal_table[200] = {
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35,
@@ -140244,6 +140284,11 @@ struct to_adaptor {
T operator()(simdjson_result<ondemand::value> &val) const noexcept; T operator()(simdjson_result<ondemand::value> &val) const noexcept;
auto operator()(padded_string_view const str) const noexcept; auto operator()(padded_string_view const str) const noexcept;
auto operator()(ondemand::parser &parser, padded_string_view const str) const noexcept; auto operator()(ondemand::parser &parser, padded_string_view const str) const noexcept;
// The std::string is padded with reserve to ensure there is enough space for padding.
// Some sanitizers may not like this, so you can use simdjson::pad instead.
// simdjson::from(simdjson::pad(str))
auto operator()(std::string str) const noexcept;
auto operator()(ondemand::parser &parser, std::string str) const noexcept;
}; };
} // namespace internal } // namespace internal
} // namespace convert } // namespace convert
@@ -140402,6 +140447,16 @@ template <typename T>
inline auto to_adaptor<T>::operator()(ondemand::parser &parser, padded_string_view const str) const noexcept { inline auto to_adaptor<T>::operator()(ondemand::parser &parser, padded_string_view const str) const noexcept {
return auto_parser<ondemand::parser *>{parser, str}; return auto_parser<ondemand::parser *>{parser, str};
} }
template <typename T>
inline auto to_adaptor<T>::operator()(std::string str) const noexcept {
return auto_parser{pad_with_reserve(str)};
}
template <typename T>
inline auto to_adaptor<T>::operator()(ondemand::parser &parser, std::string str) const noexcept {
return auto_parser<ondemand::parser *>{parser, pad_with_reserve(str)};
}
} // namespace internal } // namespace internal
} // namespace convert } // namespace convert
} // namespace simdjson } // namespace simdjson
Binary file not shown.
-20
View File
@@ -21,19 +21,6 @@ bool implementation::supported_by_runtime_system() const {
#define SIMDJSON_CONDITIONAL_INCLUDE #define SIMDJSON_CONDITIONAL_INCLUDE
#if SIMDJSON_IMPLEMENTATION_RVV
#include <simdjson/rvv/implementation.h>
namespace simdjson {
namespace internal {
static const rvv::implementation* get_rvv_singleton() {
static const rvv::implementation rvv_singleton{};
return &rvv_singleton;
}
} // namespace internal
} // namespace simdjson
#endif // SIMDJSON_IMPLEMENTATION_RVV
#if SIMDJSON_IMPLEMENTATION_ARM64 #if SIMDJSON_IMPLEMENTATION_ARM64
#include <simdjson/arm64/implementation.h> #include <simdjson/arm64/implementation.h>
namespace simdjson { namespace simdjson {
@@ -143,7 +130,6 @@ namespace internal {
+ SIMDJSON_IMPLEMENTATION_HASWELL + SIMDJSON_IMPLEMENTATION_WESTMERE \ + SIMDJSON_IMPLEMENTATION_HASWELL + SIMDJSON_IMPLEMENTATION_WESTMERE \
+ SIMDJSON_IMPLEMENTATION_ARM64 + SIMDJSON_IMPLEMENTATION_PPC64 \ + SIMDJSON_IMPLEMENTATION_ARM64 + SIMDJSON_IMPLEMENTATION_PPC64 \
+ SIMDJSON_IMPLEMENTATION_LSX + SIMDJSON_IMPLEMENTATION_LASX \ + SIMDJSON_IMPLEMENTATION_LSX + SIMDJSON_IMPLEMENTATION_LASX \
+ SIMDJSON_IMPLEMENTATION_RVV \
+ SIMDJSON_IMPLEMENTATION_FALLBACK == 1) + SIMDJSON_IMPLEMENTATION_FALLBACK == 1)
#if SIMDJSON_SINGLE_IMPLEMENTATION #if SIMDJSON_SINGLE_IMPLEMENTATION
@@ -170,9 +156,6 @@ namespace internal {
#if SIMDJSON_IMPLEMENTATION_LASX #if SIMDJSON_IMPLEMENTATION_LASX
get_lasx_singleton(); get_lasx_singleton();
#endif #endif
#if SIMDJSON_IMPLEMENTATION_RVV
get_rvv_singleton();
#endif
#if SIMDJSON_IMPLEMENTATION_FALLBACK #if SIMDJSON_IMPLEMENTATION_FALLBACK
get_fallback_singleton(); get_fallback_singleton();
#endif #endif
@@ -233,9 +216,6 @@ static const std::initializer_list<const implementation *>& get_available_implem
#if SIMDJSON_IMPLEMENTATION_LASX #if SIMDJSON_IMPLEMENTATION_LASX
get_lasx_singleton(), get_lasx_singleton(),
#endif #endif
#if SIMDJSON_IMPLEMENTATION_RVV
get_rvv_singleton(),
#endif
#if SIMDJSON_IMPLEMENTATION_FALLBACK #if SIMDJSON_IMPLEMENTATION_FALLBACK
get_fallback_singleton(), get_fallback_singleton(),
#endif #endif
-23
View File
@@ -1,23 +0,0 @@
#ifndef SIMDJSON_SRC_RVV_CPP
#define SIMDJSON_SRC_RVV_CPP
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#include <base.h>
#endif // SIMDJSON_CONDITIONAL_INCLUDE
#include <simdjson/rvv.h>
#include <simdjson/rvv/implementation.h>
namespace simdjson {
namespace rvv {
error_code implementation::create_dom_parser_implementation(
size_t, size_t,
std::unique_ptr<simdjson::internal::dom_parser_implementation>&) const noexcept {
return error_code::UNSUPPORTED_ARCHITECTURE;
}
} // namespace rvv
} // namespace simdjson
#endif // SIMDJSON_SRC_RVV_CPP
-3
View File
@@ -41,9 +41,6 @@ SIMDJSON_PUSH_DISABLE_UNUSED_WARNINGS
#if SIMDJSON_IMPLEMENTATION_LASX #if SIMDJSON_IMPLEMENTATION_LASX
#include <lasx.cpp> #include <lasx.cpp>
#endif #endif
#if SIMDJSON_IMPLEMENTATION_RVV
#include <rvv.cpp>
#endif
#if SIMDJSON_IMPLEMENTATION_FALLBACK #if SIMDJSON_IMPLEMENTATION_FALLBACK
#include <fallback.cpp> #include <fallback.cpp>
#endif #endif
+52 -1
View File
@@ -2,6 +2,7 @@
#include "simdjson/convert.h" #include "simdjson/convert.h"
#include "test_ondemand.h" #include "test_ondemand.h"
#include <chrono>
#include <map> #include <map>
#include <ranges> #include <ranges>
#include <string> #include <string>
@@ -21,6 +22,24 @@ private:
std::string date_str; std::string date_str;
}; };
struct Meeting {
std::string title;
std::vector<std::string> attendees;
std::optional<std::string> location;
bool is_recurring;
};
struct MeetingTime {
std::string title;
std::chrono::system_clock::time_point start_time;
std::vector<std::string> attendees;
std::optional<std::string> location;
bool is_recurring;
};
namespace simdjson { namespace simdjson {
template <typename simdjson_value> template <typename simdjson_value>
auto tag_invoke(deserialize_tag, simdjson_value &val, MyDate& date) { auto tag_invoke(deserialize_tag, simdjson_value &val, MyDate& date) {
@@ -160,6 +179,38 @@ bool simple() {
ASSERT_SUCCESS(doc.get(p)); ASSERT_SUCCESS(doc.get(p));
TEST_SUCCEED(); TEST_SUCCEED();
} }
bool meeting_test() {
TEST_START();
std::string json = simdjson::to_json(Meeting{
.title = "CppCon Planning",
.attendees = {"Alice", "Bob", "Charlie"},
.location = "Denver",
.is_recurring = true
});
Meeting m2 = simdjson::from(json);
std::cout << m2.title << std::endl;
TEST_SUCCEED();
}
bool meeting_time_test() {
TEST_START();
auto start_time = std::chrono::system_clock::now();
std::string json = simdjson::to_json(MeetingTime{
.title = "CppCon Planning",
.start_time = start_time,
.attendees = {"Alice", "Bob", "Charlie"},
.location = "Denver",
.is_recurring = true
});
std::cout << json << std::endl;
MeetingTime m2 = simdjson::from(json);
//ASSERT_EQUAL(m2.start_time, start_time);
std::cout << m2.title << std::endl;
TEST_SUCCEED();
}
#endif #endif
bool broken() { bool broken() {
TEST_START(); TEST_START();
@@ -415,7 +466,7 @@ bool test_to_vs_from_equivalence() {
bool run() { bool run() {
return return
#if SIMDJSON_STATIC_REFLECTION #if SIMDJSON_STATIC_REFLECTION
bad_player() && good_player() && complicated_weather_test() && meeting_time_test() && meeting_test() && bad_player() && good_player() && complicated_weather_test() &&
#endif #endif
#if SIMDJSON_EXCEPTIONS && SIMDJSON_SUPPORTS_CONCEPTS #if SIMDJSON_EXCEPTIONS && SIMDJSON_SUPPORTS_CONCEPTS
broken() && simple() && simple_optional() && with_parser() && to_array() && broken() && simple() && simple_optional() && with_parser() && to_array() &&