From b6997a56df5406333e7d363f6ce07764433e2dab Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 26 Jun 2020 12:15:16 -0400 Subject: [PATCH] Patching things up and adding tests. --- .drone.yml | 42 ++++++++++++++++++++++++++++++ include/simdjson/inline/tape_ref.h | 6 ++--- singleheader/amalgamate_demo.cpp | 2 +- singleheader/simdjson.cpp | 2 +- singleheader/simdjson.h | 8 +++--- src/simdprune_tables.h | 6 +++++ 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index 33c3ac7c..2166727a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,4 +1,46 @@ kind: pipeline +name: i386-gcc # we do not support 32-bit systems, but we run tests +platform: { os: linux, arch: amd64 } +steps: +- name: Build and Test + image: i386/ubuntu + environment: + CC: gcc + CXX: g++ + BUILD_FLAGS: -- -j + CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON + CTEST_FLAGS: -j4 --output-on-failure -E checkperf -E numberparsingcheck # A ULP marging 1 is detected on 32-bit GCC + commands: + - apt-get update -qq + - apt-get install -y g++ cmake gcc + - mkdir build + - cd build + - cmake $CMAKE_FLAGS .. + - cmake --build . $BUILD_FLAGS + - ctest $CTEST_FLAGS +--- +kind: pipeline +name: i386-clang # we do not support 32-bit systems, but we run tests +platform: { os: linux, arch: amd64 } +steps: +- name: Build and Test + image: i386/ubuntu + environment: + CC: clang-6.0 + CXX: clang++-6.0 + BUILD_FLAGS: -- -j + CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON + CTEST_FLAGS: -j4 --output-on-failure -E checkperf + commands: + - apt-get update -qq + - apt-get install -y clang++-6.0 cmake + - mkdir build + - cd build + - cmake $CMAKE_FLAGS .. + - cmake --build . $BUILD_FLAGS + - ctest $CTEST_FLAGS +--- +kind: pipeline name: gcc9 platform: { os: linux, arch: amd64 } steps: diff --git a/include/simdjson/inline/tape_ref.h b/include/simdjson/inline/tape_ref.h index 1d7e5efd..deccbaae 100644 --- a/include/simdjson/inline/tape_ref.h +++ b/include/simdjson/inline/tape_ref.h @@ -81,15 +81,15 @@ really_inline T tape_ref::next_tape_value() const noexcept { } really_inline uint32_t internal::tape_ref::get_string_length() const noexcept { - uint64_t string_buf_index = size_t(tape_value()); + size_t string_buf_index = size_t(tape_value()); uint32_t len; memcpy(&len, &doc->string_buf[size_t(string_buf_index)], sizeof(len)); return len; } really_inline const char * internal::tape_ref::get_c_str() const noexcept { - uint64_t string_buf_index = size_t(tape_value()); - return reinterpret_cast(&doc->string_buf[size_t(string_buf_index) + sizeof(uint32_t)]); + size_t string_buf_index = size_t(tape_value()); + return reinterpret_cast(&doc->string_buf[string_buf_index + sizeof(uint32_t)]); } inline std::string_view internal::tape_ref::get_string_view() const noexcept { diff --git a/singleheader/amalgamate_demo.cpp b/singleheader/amalgamate_demo.cpp index 04b81412..464db2e8 100644 --- a/singleheader/amalgamate_demo.cpp +++ b/singleheader/amalgamate_demo.cpp @@ -1,4 +1,4 @@ -/* auto-generated on Fri Jun 26 01:04:15 UTC 2020. Do not edit! */ +/* auto-generated on Fri Jun 26 15:35:58 UTC 2020. Do not edit! */ #include #include "simdjson.h" diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index f9199c2d..47f31cc9 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on Fri Jun 26 01:04:15 UTC 2020. Do not edit! */ +/* auto-generated on Fri Jun 26 15:35:58 UTC 2020. Do not edit! */ /* begin file src/simdjson.cpp */ #include "simdjson.h" diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index 930fdee8..4b38763d 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on Fri Jun 26 01:04:15 UTC 2020. Do not edit! */ +/* auto-generated on Fri Jun 26 15:35:58 UTC 2020. Do not edit! */ /* begin file include/simdjson.h */ #ifndef SIMDJSON_H #define SIMDJSON_H @@ -7647,15 +7647,15 @@ really_inline T tape_ref::next_tape_value() const noexcept { } really_inline uint32_t internal::tape_ref::get_string_length() const noexcept { - uint64_t string_buf_index = size_t(tape_value()); + size_t string_buf_index = size_t(tape_value()); uint32_t len; memcpy(&len, &doc->string_buf[size_t(string_buf_index)], sizeof(len)); return len; } really_inline const char * internal::tape_ref::get_c_str() const noexcept { - uint64_t string_buf_index = size_t(tape_value()); - return reinterpret_cast(&doc->string_buf[size_t(string_buf_index) + sizeof(uint32_t)]); + size_t string_buf_index = size_t(tape_value()); + return reinterpret_cast(&doc->string_buf[string_buf_index + sizeof(uint32_t)]); } inline std::string_view internal::tape_ref::get_string_view() const noexcept { diff --git a/src/simdprune_tables.h b/src/simdprune_tables.h index 21be30c6..8f27fbda 100644 --- a/src/simdprune_tables.h +++ b/src/simdprune_tables.h @@ -1,5 +1,9 @@ #ifndef SIMDJSON_SIMDPRUNE_TABLES_H #define SIMDJSON_SIMDPRUNE_TABLES_H + + +#if SIMDJSON_IMPLEMENTATION_ARM64 || SIMDJSON_IMPLEMENTATION_HASWELL || SIMDJSON_IMPLEMENTATION_WESTMERE + #include namespace simdjson { // table modified and copied from @@ -127,4 +131,6 @@ static const uint64_t thintable_epi8[256] = { } // namespace simdjson + +#endif // SIMDJSON_IMPLEMENTATION_ARM64 || SIMDJSON_IMPLEMENTATION_HASWELL || SIMDJSON_IMPLEMENTATION_WESTMERE #endif // SIMDJSON_SIMDPRUNE_TABLES_H