diff --git a/.github/workflows/aarch64.yml b/.github/workflows/aarch64.yml new file mode 100644 index 000000000..e50544919 --- /dev/null +++ b/.github/workflows/aarch64.yml @@ -0,0 +1,29 @@ +name: Ubuntu ppc64le (GCC 11) + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v2 + name: Test + id: runcmd + with: + arch: aarch64 + distro: ubuntu_latest + githubToken: ${{ github.token }} + install: | + apt-get update -q -y + apt-get install -y cmake make g++ + run: | + cmake -DSIMDJSON_SANITIZE_UNDEFINED=ON -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -B build + cmake --build build -j=2 + ctest --output-on-failure --test-dir build diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 5be64bb36..c0addddaf 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -17,7 +17,7 @@ jobs: fuzz-seconds: 600 dry-run: false - name: Upload Crash - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts diff --git a/.github/workflows/fix-trailing-whitespace.yml b/.github/workflows/fix-trailing-whitespace.yml index a4f7fc227..a68409813 100644 --- a/.github/workflows/fix-trailing-whitespace.yml +++ b/.github/workflows/fix-trailing-whitespace.yml @@ -24,7 +24,7 @@ jobs: echo "no trailing whitespace found, good!" fi - name: Archive whitespace patch - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: always() with: name: whitespace-patch diff --git a/.github/workflows/msys2.yml b/.github/workflows/msys2.yml index 3372a6994..41b3a9236 100644 --- a/.github/workflows/msys2.yml +++ b/.github/workflows/msys2.yml @@ -22,7 +22,7 @@ jobs: - msystem: "MINGW64" install: mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc type: Debug - - msystem: "MINGW64" + - msystem: "MINGW64" install: mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc type: RelWithDebInfo env: diff --git a/.github/workflows/ppc64.yml b/.github/workflows/ppc64.yml index 36f30331f..3c022f499 100644 --- a/.github/workflows/ppc64.yml +++ b/.github/workflows/ppc64.yml @@ -24,6 +24,6 @@ jobs: apt-get update -q -y apt-get install -y cmake make g++ run: | - cmake -DCMAKE_BUILD_TYPE=Release -B build + cmake -DCMAKE_BUILD_TYPE=Release -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -B build cmake --build build -j=2 ctest --output-on-failure --test-dir build diff --git a/.github/workflows/riscv64.yml b/.github/workflows/riscv64.yml index 1dc214187..2abe22e38 100644 --- a/.github/workflows/riscv64.yml +++ b/.github/workflows/riscv64.yml @@ -24,6 +24,6 @@ jobs: apt-get update -q -y apt-get install -y cmake make g++ run: | - cmake -DCMAKE_BUILD_TYPE=Release -B build + cmake -DCMAKE_BUILD_TYPE=Release -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -B build cmake --build build -j=2 ctest --output-on-failure --test-dir build diff --git a/.github/workflows/s390x.yml b/.github/workflows/s390x.yml index a750a6e4c..ea7c28aa5 100644 --- a/.github/workflows/s390x.yml +++ b/.github/workflows/s390x.yml @@ -24,6 +24,6 @@ jobs: apt-get update -q -y apt-get install -y cmake make g++ run: | - cmake -DCMAKE_BUILD_TYPE=Release -B build + cmake -DCMAKE_BUILD_TYPE=Release -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -B build cmake --build build -j=2 ctest --output-on-failure --test-dir build diff --git a/.github/workflows/vs17-ci.yml b/.github/workflows/vs17-ci.yml index 72eb96795..348e75e74 100644 --- a/.github/workflows/vs17-ci.yml +++ b/.github/workflows/vs17-ci.yml @@ -26,15 +26,15 @@ jobs: run: | cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -DBUILD_SHARED_LIBS=${{matrix.shared}} -B build - name: Build Debug - run: cmake --build build --config ${{build_type}} --verbose + run: cmake --build build --config ${{matrix.build_type}} --verbose - name: Run tests run: | cd build - ctest -C ${{build_type}} -LE explicitonly --output-on-failure + ctest -C ${{matrix.build_type}} -LE explicitonly --output-on-failure - name: Install run: | - cmake --install build --config ${{build_type}} + cmake --install build --config ${{matrix.build_type}} - name: Test Installation run: | cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build_install_test tests/installation_tests/find - cmake --build build_install_test --config ${{build_type}} \ No newline at end of file + cmake --build build_install_test --config ${{matrix.build_type}} \ No newline at end of file diff --git a/include/simdjson/arm64/numberparsing_defs.h b/include/simdjson/arm64/numberparsing_defs.h index f5e85b747..a765cb9a4 100644 --- a/include/simdjson/arm64/numberparsing_defs.h +++ b/include/simdjson/arm64/numberparsing_defs.h @@ -51,6 +51,12 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace arm64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_ARM64_NUMBERPARSING_DEFS_H diff --git a/include/simdjson/fallback/numberparsing_defs.h b/include/simdjson/fallback/numberparsing_defs.h index e807423e6..490a298dd 100644 --- a/include/simdjson/fallback/numberparsing_defs.h +++ b/include/simdjson/fallback/numberparsing_defs.h @@ -75,6 +75,12 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace fallback } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H diff --git a/include/simdjson/generic/numberparsing.h b/include/simdjson/generic/numberparsing.h index facc2acc6..5b8fdfcd7 100644 --- a/include/simdjson/generic/numberparsing.h +++ b/include/simdjson/generic/numberparsing.h @@ -574,7 +574,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // diff --git a/include/simdjson/lasx/numberparsing_defs.h b/include/simdjson/lasx/numberparsing_defs.h index cb9278261..3c4020c65 100644 --- a/include/simdjson/lasx/numberparsing_defs.h +++ b/include/simdjson/lasx/numberparsing_defs.h @@ -36,6 +36,12 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lasx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LASX_NUMBERPARSING_DEFS_H diff --git a/include/simdjson/lsx/numberparsing_defs.h b/include/simdjson/lsx/numberparsing_defs.h index 1dfe4264e..4f90203b2 100644 --- a/include/simdjson/lsx/numberparsing_defs.h +++ b/include/simdjson/lsx/numberparsing_defs.h @@ -36,6 +36,12 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lsx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LSX_NUMBERPARSING_DEFS_H diff --git a/include/simdjson/portability.h b/include/simdjson/portability.h index ff65aa9de..6aa892eff 100644 --- a/include/simdjson/portability.h +++ b/include/simdjson/portability.h @@ -201,4 +201,43 @@ using std::size_t; #endif + + +#if defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined _WIN32 +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#if defined(__APPLE__) || defined(__FreeBSD__) +#include +#elif defined(sun) || defined(__sun) +#include +#elif defined(__MVS__) +#include +#else +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include +#endif +# +#ifndef __BYTE_ORDER__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#ifndef __ORDER_LITTLE_ENDIAN__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#define SIMDJSON_IS_BIG_ENDIAN 1 +#endif +#endif + + #endif // SIMDJSON_PORTABILITY_H diff --git a/include/simdjson/ppc64/numberparsing_defs.h b/include/simdjson/ppc64/numberparsing_defs.h index d21c25b18..36861c0bf 100644 --- a/include/simdjson/ppc64/numberparsing_defs.h +++ b/include/simdjson/ppc64/numberparsing_defs.h @@ -60,6 +60,12 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace ppc64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_PPC64_NUMBERPARSING_DEFS_H diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index d79fc703a..57b5561b1 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2024-08-26 09:37:03 -0400. Do not edit! */ +/* auto-generated on 2024-09-17 15:48:50 -0400. Do not edit! */ /* including simdjson.cpp: */ /* begin file simdjson.cpp */ #define SIMDJSON_SRC_SIMDJSON_CPP @@ -284,6 +284,45 @@ using std::size_t; #endif + + +#if defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined _WIN32 +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#if defined(__APPLE__) || defined(__FreeBSD__) +#include +#elif defined(sun) || defined(__sun) +#include +#elif defined(__MVS__) +#include +#else +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include +#endif +# +#ifndef __BYTE_ORDER__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#ifndef __ORDER_LITTLE_ENDIAN__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#define SIMDJSON_IS_BIG_ENDIAN 1 +#endif +#endif + + #endif // SIMDJSON_PORTABILITY_H /* end file simdjson/portability.h */ @@ -549,7 +588,6 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#pragma once #ifndef NONSTD_SV_LITE_H_INCLUDED #define NONSTD_SV_LITE_H_INCLUDED @@ -7639,6 +7677,12 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) { return input_num & (input_num-1); } +// We sometimes call leading_zeroes on inputs that are zero, +// but the algorithms do not end up using the returned value. +// Sadly, sanitizers are not smart enough to figure it out. +// Applies only when SIMDJSON_PREFER_REVERSE_BITS is defined and true. +// (See below.) +SIMDJSON_NO_SANITIZE_UNDEFINED /* result might be undefined when input_num is zero */ simdjson_inline int leading_zeroes(uint64_t input_num) { #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO @@ -7811,7 +7855,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace arm64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_ARM64_NUMBERPARSING_DEFS_H /* end file simdjson/arm64/numberparsing_defs.h */ @@ -9428,7 +9478,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -10395,6 +10444,12 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) { return input_num & (input_num-1); } +// We sometimes call leading_zeroes on inputs that are zero, +// but the algorithms do not end up using the returned value. +// Sadly, sanitizers are not smart enough to figure it out. +// Applies only when SIMDJSON_PREFER_REVERSE_BITS is defined and true. +// (See below.) +SIMDJSON_NO_SANITIZE_UNDEFINED /* result might be undefined when input_num is zero */ simdjson_inline int leading_zeroes(uint64_t input_num) { #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO @@ -10567,7 +10622,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace arm64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_ARM64_NUMBERPARSING_DEFS_H /* end file simdjson/arm64/numberparsing_defs.h */ @@ -15770,7 +15831,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -21984,7 +22044,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -26750,7 +26809,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace ppc64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_PPC64_NUMBERPARSING_DEFS_H /* end file simdjson/ppc64/numberparsing_defs.h */ @@ -28354,7 +28419,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -29494,7 +29558,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace ppc64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_PPC64_NUMBERPARSING_DEFS_H /* end file simdjson/ppc64/numberparsing_defs.h */ @@ -35090,7 +35160,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -40176,7 +40245,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lsx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LSX_NUMBERPARSING_DEFS_H /* end file simdjson/lsx/numberparsing_defs.h */ @@ -41650,7 +41725,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -42705,7 +42779,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lsx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LSX_NUMBERPARSING_DEFS_H /* end file simdjson/lsx/numberparsing_defs.h */ @@ -46159,7 +46239,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lasx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LASX_NUMBERPARSING_DEFS_H /* end file simdjson/lasx/numberparsing_defs.h */ @@ -47649,7 +47735,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -48704,7 +48789,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lasx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LASX_NUMBERPARSING_DEFS_H /* end file simdjson/lasx/numberparsing_defs.h */ @@ -52188,7 +52279,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace fallback } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file simdjson/fallback/numberparsing_defs.h */ @@ -53247,7 +53344,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -54322,7 +54418,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace fallback } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file simdjson/fallback/numberparsing_defs.h */ diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index f21cd9381..d4b2cf0f9 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on 2024-08-26 09:37:03 -0400. Do not edit! */ +/* auto-generated on 2024-09-17 15:48:50 -0400. Do not edit! */ /* including simdjson.h: */ /* begin file simdjson.h */ #ifndef SIMDJSON_H @@ -304,6 +304,45 @@ using std::size_t; #endif + + +#if defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined _WIN32 +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#if defined(__APPLE__) || defined(__FreeBSD__) +#include +#elif defined(sun) || defined(__sun) +#include +#elif defined(__MVS__) +#include +#else +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include +#endif +# +#ifndef __BYTE_ORDER__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#ifndef __ORDER_LITTLE_ENDIAN__ +// safe choice +#define SIMDJSON_IS_BIG_ENDIAN 0 +#endif +# +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define SIMDJSON_IS_BIG_ENDIAN 0 +#else +#define SIMDJSON_IS_BIG_ENDIAN 1 +#endif +#endif + + #endif // SIMDJSON_PORTABILITY_H /* end file simdjson/portability.h */ @@ -569,7 +608,6 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#pragma once #ifndef NONSTD_SV_LITE_H_INCLUDED #define NONSTD_SV_LITE_H_INCLUDED @@ -3911,6 +3949,9 @@ inline padded_string::padded_string(const char *data, size_t length) noexcept if ((data != nullptr) && (data_ptr != nullptr)) { std::memcpy(data_ptr, data, length); } + if (data_ptr == nullptr) { + viable_size = 0; + } } #ifdef __cpp_char8_t inline padded_string::padded_string(const char8_t *data, size_t length) noexcept @@ -3918,12 +3959,17 @@ inline padded_string::padded_string(const char8_t *data, size_t length) noexcept if ((data != nullptr) && (data_ptr != nullptr)) { std::memcpy(data_ptr, reinterpret_cast(data), length); } + if (data_ptr == nullptr) { + viable_size = 0; + } } #endif // note: do not pass std::string arguments by value inline padded_string::padded_string(const std::string & str_ ) noexcept : viable_size(str_.size()), data_ptr(internal::allocate_padded_buffer(str_.size())) { - if (data_ptr != nullptr) { + if (data_ptr == nullptr) { + viable_size = 0; + } else { std::memcpy(data_ptr, str_.data(), str_.size()); } } @@ -9854,6 +9900,12 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) { return input_num & (input_num-1); } +// We sometimes call leading_zeroes on inputs that are zero, +// but the algorithms do not end up using the returned value. +// Sadly, sanitizers are not smart enough to figure it out. +// Applies only when SIMDJSON_PREFER_REVERSE_BITS is defined and true. +// (See below.) +SIMDJSON_NO_SANITIZE_UNDEFINED /* result might be undefined when input_num is zero */ simdjson_inline int leading_zeroes(uint64_t input_num) { #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO @@ -10026,7 +10078,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace arm64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_ARM64_NUMBERPARSING_DEFS_H /* end file simdjson/arm64/numberparsing_defs.h */ @@ -11643,7 +11701,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -12687,7 +12744,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace fallback } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file simdjson/fallback/numberparsing_defs.h */ @@ -13746,7 +13809,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -16341,7 +16403,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -18935,7 +18996,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -20040,7 +20100,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace ppc64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_PPC64_NUMBERPARSING_DEFS_H /* end file simdjson/ppc64/numberparsing_defs.h */ @@ -21644,7 +21710,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -24676,7 +24741,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -25705,7 +25769,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lsx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LSX_NUMBERPARSING_DEFS_H /* end file simdjson/lsx/numberparsing_defs.h */ @@ -27179,7 +27249,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -28205,7 +28274,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lasx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LASX_NUMBERPARSING_DEFS_H /* end file simdjson/lasx/numberparsing_defs.h */ @@ -29695,7 +29770,6 @@ simdjson_unused simdjson_inline simdjson_result get_number_type(con // Our objective is accurate parsing (ULP of 0) at high speed. template simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) { - // // Check for minus sign // @@ -30668,6 +30742,12 @@ simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) { return input_num & (input_num-1); } +// We sometimes call leading_zeroes on inputs that are zero, +// but the algorithms do not end up using the returned value. +// Sadly, sanitizers are not smart enough to figure it out. +// Applies only when SIMDJSON_PREFER_REVERSE_BITS is defined and true. +// (See below.) +SIMDJSON_NO_SANITIZE_UNDEFINED /* result might be undefined when input_num is zero */ simdjson_inline int leading_zeroes(uint64_t input_num) { #ifdef SIMDJSON_REGULAR_VISUAL_STUDIO @@ -30840,7 +30920,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace arm64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_ARM64_NUMBERPARSING_DEFS_H /* end file simdjson/arm64/numberparsing_defs.h */ @@ -41865,7 +41951,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace fallback } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H /* end file simdjson/fallback/numberparsing_defs.h */ @@ -74310,7 +74402,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace ppc64 } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_PPC64_NUMBERPARSING_DEFS_H /* end file simdjson/ppc64/numberparsing_defs.h */ @@ -96703,7 +96801,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lsx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LSX_NUMBERPARSING_DEFS_H /* end file simdjson/lsx/numberparsing_defs.h */ @@ -107567,7 +107671,13 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t } // namespace lasx } // namespace simdjson +#ifndef SIMDJSON_SWAR_NUMBER_PARSING +#if SIMDJSON_IS_BIG_ENDIAN +#define SIMDJSON_SWAR_NUMBER_PARSING 0 +#else #define SIMDJSON_SWAR_NUMBER_PARSING 1 +#endif +#endif #endif // SIMDJSON_LASX_NUMBERPARSING_DEFS_H /* end file simdjson/lasx/numberparsing_defs.h */