react-native-quick-crypto 1.0.18 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QuickCrypto.podspec +12 -38
- package/README.md +2 -0
- package/android/CMakeLists.txt +3 -0
- package/cpp/utils/HybridUtils.cpp +39 -77
- package/deps/simdutf/.clang-format +4 -0
- package/deps/simdutf/.github/ISSUE_TEMPLATE/bug_report.md +62 -0
- package/deps/simdutf/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/deps/simdutf/.github/ISSUE_TEMPLATE/feature_request.md +35 -0
- package/deps/simdutf/.github/ISSUE_TEMPLATE/standard-issue-template.md +29 -0
- package/deps/simdutf/.github/pull_request_template.md +51 -0
- package/deps/simdutf/.github/workflows/aarch64.yml +39 -0
- package/deps/simdutf/.github/workflows/alpine.yml +27 -0
- package/deps/simdutf/.github/workflows/amalgamation_demos.yml +34 -0
- package/deps/simdutf/.github/workflows/armv7.yml +32 -0
- package/deps/simdutf/.github/workflows/atomic_fuzz.yml +25 -0
- package/deps/simdutf/.github/workflows/cifuzz.yml +37 -0
- package/deps/simdutf/.github/workflows/clangformat.yml +36 -0
- package/deps/simdutf/.github/workflows/debian-latestcxxstandards.yml +40 -0
- package/deps/simdutf/.github/workflows/debian.yml +33 -0
- package/deps/simdutf/.github/workflows/documentation.yml +36 -0
- package/deps/simdutf/.github/workflows/emscripten.yml +19 -0
- package/deps/simdutf/.github/workflows/loongarch64-gcc-14.2.yml +39 -0
- package/deps/simdutf/.github/workflows/macos-latest.yml +29 -0
- package/deps/simdutf/.github/workflows/msys2-clang.yml +48 -0
- package/deps/simdutf/.github/workflows/msys2.yml +50 -0
- package/deps/simdutf/.github/workflows/ppc64le.yml +29 -0
- package/deps/simdutf/.github/workflows/rvv-1024-clang-18.yml +35 -0
- package/deps/simdutf/.github/workflows/rvv-128-clang-17.yml +35 -0
- package/deps/simdutf/.github/workflows/rvv-256-gcc-14.yml +31 -0
- package/deps/simdutf/.github/workflows/s390x.yml +29 -0
- package/deps/simdutf/.github/workflows/selective-amalgamation.yml +29 -0
- package/deps/simdutf/.github/workflows/typos.yml +19 -0
- package/deps/simdutf/.github/workflows/ubuntu22-cxx20.yml +30 -0
- package/deps/simdutf/.github/workflows/ubuntu22.yml +32 -0
- package/deps/simdutf/.github/workflows/ubuntu22_gcc12.yml +27 -0
- package/deps/simdutf/.github/workflows/ubuntu22sani.yml +29 -0
- package/deps/simdutf/.github/workflows/ubuntu24-cxxstandards.yml +34 -0
- package/deps/simdutf/.github/workflows/ubuntu24-unsignedchar.yml +34 -0
- package/deps/simdutf/.github/workflows/ubuntu24.yml +32 -0
- package/deps/simdutf/.github/workflows/ubuntu24sani.yml +36 -0
- package/deps/simdutf/.github/workflows/ubuntu24sani_clang.yml +29 -0
- package/deps/simdutf/.github/workflows/vs17-arm-ci.yml +21 -0
- package/deps/simdutf/.github/workflows/vs17-ci-cxx20.yml +41 -0
- package/deps/simdutf/.github/workflows/vs17-ci.yml +41 -0
- package/deps/simdutf/.github/workflows/vs17-clang-ci.yml +41 -0
- package/deps/simdutf/.github/workflows/vs17-cxxstandards.yml +36 -0
- package/deps/simdutf/AI_USAGE_POLICY.md +56 -0
- package/deps/simdutf/AUTHORS +6 -0
- package/deps/simdutf/CMakeLists.txt +231 -0
- package/deps/simdutf/CONTRIBUTING.md +214 -0
- package/deps/simdutf/CONTRIBUTORS +1 -0
- package/deps/simdutf/Doxyfile +2584 -0
- package/deps/simdutf/LICENSE-APACHE +201 -0
- package/deps/simdutf/LICENSE-MIT +18 -0
- package/deps/simdutf/Makefile.crosscompile +54 -0
- package/deps/simdutf/README-RVV.md +16 -0
- package/deps/simdutf/README.md +2782 -0
- package/deps/simdutf/SECURITY.md +8 -0
- package/deps/simdutf/benchmarks/CMakeLists.txt +101 -0
- package/deps/simdutf/benchmarks/alignment.cpp +150 -0
- package/deps/simdutf/benchmarks/base64/CMakeLists.txt +30 -0
- package/deps/simdutf/benchmarks/base64/benchmark_base64.cpp +875 -0
- package/deps/simdutf/benchmarks/base64/libbase64_spaces.h +49 -0
- package/deps/simdutf/benchmarks/base64/node_base64.h +227 -0
- package/deps/simdutf/benchmarks/base64/openssl3_base64.h +334 -0
- package/deps/simdutf/benchmarks/benchmark.cpp +65 -0
- package/deps/simdutf/benchmarks/benchmark_to_well_formed_utf16.cpp +347 -0
- package/deps/simdutf/benchmarks/competition/.clang-format-ignore +5 -0
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.cpp +1276 -0
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.h +595 -0
- package/deps/simdutf/benchmarks/competition/README.md +7 -0
- package/deps/simdutf/benchmarks/competition/hoehrmann/hoehrmann.h +91 -0
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16.h +444 -0
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16_tables.h +13183 -0
- package/deps/simdutf/benchmarks/competition/inoue2008/script.py +73 -0
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.cpp +738 -0
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.h +293 -0
- package/deps/simdutf/benchmarks/competition/u8u16/COPYRIGHT +8 -0
- package/deps/simdutf/benchmarks/competition/u8u16/Makefile +44 -0
- package/deps/simdutf/benchmarks/competition/u8u16/OSL3.0.txt +169 -0
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/BOM_Profiler.h +148 -0
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/i386_timer.h +45 -0
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/ppc_timer.c +34 -0
- package/deps/simdutf/benchmarks/competition/u8u16/README +56 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/config_defs.h +43 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/g4_config.h +27 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/mmx_config.h +16 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_config.h +18 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_ideal_config.h +16 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/spu_config.h +28 -0
- package/deps/simdutf/benchmarks/competition/u8u16/config/ssse3_config.h +20 -0
- package/deps/simdutf/benchmarks/competition/u8u16/iconv_u8u16.c +2 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/altivec_simd.h +440 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_basic_ops.py +121 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_half_operand_versions.py +158 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_test.py +270 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd.h +141 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_basic.h +216 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_built_in.h +119 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_modified.h +2430 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/outline.txt +39 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/spu_simd.h +421 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/sse_simd.h +836 -0
- package/deps/simdutf/benchmarks/competition/u8u16/lib/stdint.h +222 -0
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_BE.c +4 -0
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_LE.c +5 -0
- package/deps/simdutf/benchmarks/competition/u8u16/proto/u8u16.py +390 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/Makefile +18 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/bytelex.h +448 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/charsets/ASCII_EBCDIC.h +284 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.c +1975 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.pdf +0 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.w +2263 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/multiliteral.h +239 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/u8u16.c +232 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/x8x16.c +194 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.c +193 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.h +167 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.c +288 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.h +117 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_g4.c +2 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_mmx.c +2 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4.c +3 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4_ideal.c +2 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_spu.c +2 -0
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_ssse3.c +3 -0
- package/deps/simdutf/benchmarks/competition/u8u16/x8x16_p4.c +2 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/LICENSE +23 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/data/test_minimal.txt +44 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/readme.md +106 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.cmd +11 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.sh +13 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_corr_tests.sh +13 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_example.sh +13 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_file_conv.sh +14 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_lib.sh +11 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_sample.sh +8 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_corr_tests.cmd +12 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_example.cmd +13 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_file_conv.cmd +14 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_lib.cmd +11 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_sample.cmd +8 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_corr_tests.cmd +11 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_example.cmd +12 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_file_conv.cmd +13 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_lib.cmd +10 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_sample.cmd +9 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/html_table.py +25 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/measure.py +94 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/resize.py +20 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_all.cmd +2 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_interm.cmd +1 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/CustomMemcpy.h +75 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/PerfDefs.h +47 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.cpp +17 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.h +76 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/AllProcessors.cpp +35 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.cpp +117 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.h +210 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferDecoder.h +158 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferEncoder.h +104 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorPlugins.h +334 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorSelector.h +186 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.cpp +140 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.h +42 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderProcess.h +100 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/Dfa.h +57 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.cpp +85 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.h +27 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderProcess.h +126 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/ProcessTrivial.h +108 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.cpp +139 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.h +74 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.cpp +65 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.h +91 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/CorrectnessTests.cpp +772 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/Example.cpp +12 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/FileConverter.cpp +486 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/iconv_sample.c +162 -0
- package/deps/simdutf/benchmarks/competition/utf8lut/src/utf8lut.h +15 -0
- package/deps/simdutf/benchmarks/competition/utf8sse4/fromutf8-sse.cpp +292 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/LICENSE +23 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/README.md +1503 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/checked.h +335 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/core.h +338 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp11.h +103 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp17.h +103 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/unchecked.h +274 -0
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8.h +34 -0
- package/deps/simdutf/benchmarks/dataset/README.md +155 -0
- package/deps/simdutf/benchmarks/dataset/emoji.txt +204 -0
- package/deps/simdutf/benchmarks/dataset/scripts/utf8type.py +40 -0
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/Makefile +80 -0
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/convert_to_utf6.py +20 -0
- package/deps/simdutf/benchmarks/find/CMakeLists.txt +6 -0
- package/deps/simdutf/benchmarks/find/findbenchmark.cpp +63 -0
- package/deps/simdutf/benchmarks/find/findbenchmarker.h +46 -0
- package/deps/simdutf/benchmarks/shortbench.cpp +555 -0
- package/deps/simdutf/benchmarks/src/CMakeLists.txt +52 -0
- package/deps/simdutf/benchmarks/src/apple_arm_events.h +1104 -0
- package/deps/simdutf/benchmarks/src/benchmark.cpp +3899 -0
- package/deps/simdutf/benchmarks/src/benchmark.h +317 -0
- package/deps/simdutf/benchmarks/src/benchmark_base.cpp +144 -0
- package/deps/simdutf/benchmarks/src/benchmark_base.h +98 -0
- package/deps/simdutf/benchmarks/src/cmdline.cpp +176 -0
- package/deps/simdutf/benchmarks/src/cmdline.h +35 -0
- package/deps/simdutf/benchmarks/src/event_counter.h +162 -0
- package/deps/simdutf/benchmarks/src/linux-perf-events.h +104 -0
- package/deps/simdutf/benchmarks/stream.cpp +209 -0
- package/deps/simdutf/benchmarks/threaded.cpp +123 -0
- package/deps/simdutf/cmake/CPM.cmake +1363 -0
- package/deps/simdutf/cmake/JoinPaths.cmake +23 -0
- package/deps/simdutf/cmake/add_cpp_test.cmake +68 -0
- package/deps/simdutf/cmake/simdutf-config.cmake.in +2 -0
- package/deps/simdutf/cmake/simdutf-flags.cmake +26 -0
- package/deps/simdutf/cmake/toolchains-ci/riscv64-linux-gnu.cmake +4 -0
- package/deps/simdutf/cmake/toolchains-dev/README.md +32 -0
- package/deps/simdutf/cmake/toolchains-dev/aarch64.cmake +14 -0
- package/deps/simdutf/cmake/toolchains-dev/loongarch64.cmake +22 -0
- package/deps/simdutf/cmake/toolchains-dev/powerpc64.cmake +16 -0
- package/deps/simdutf/cmake/toolchains-dev/powerpc64le.cmake +16 -0
- package/deps/simdutf/cmake/toolchains-dev/riscv64.cmake +16 -0
- package/deps/simdutf/cmake/toolchains-dev/rvv-spike.cmake +38 -0
- package/deps/simdutf/doc/avx512.png +0 -0
- package/deps/simdutf/doc/logo.png +0 -0
- package/deps/simdutf/doc/logo.svg +165 -0
- package/deps/simdutf/doc/node2023.png +0 -0
- package/deps/simdutf/doc/shortinput.md +78 -0
- package/deps/simdutf/doc/utf16utf8.png +0 -0
- package/deps/simdutf/doc/utf8utf16.png +0 -0
- package/deps/simdutf/doc/widelogo.png +0 -0
- package/deps/simdutf/doxygen.py +50 -0
- package/deps/simdutf/fuzz/.clang-format +9 -0
- package/deps/simdutf/fuzz/CMakeLists.txt +45 -0
- package/deps/simdutf/fuzz/README.md +168 -0
- package/deps/simdutf/fuzz/atomic_base64.cpp +448 -0
- package/deps/simdutf/fuzz/base64.cpp +278 -0
- package/deps/simdutf/fuzz/build.sh +83 -0
- package/deps/simdutf/fuzz/conversion.cpp +669 -0
- package/deps/simdutf/fuzz/helpers/.clang-format-ignore +1 -0
- package/deps/simdutf/fuzz/helpers/common.h +135 -0
- package/deps/simdutf/fuzz/helpers/nameof.hpp +1258 -0
- package/deps/simdutf/fuzz/main.cpp +72 -0
- package/deps/simdutf/fuzz/minimize_and_cleanse.sh +87 -0
- package/deps/simdutf/fuzz/misc.cpp +216 -0
- package/deps/simdutf/fuzz/random_fuzz.sh +154 -0
- package/deps/simdutf/fuzz/roundtrip.cpp +588 -0
- package/deps/simdutf/fuzz/safe_conversion.cpp +104 -0
- package/deps/simdutf/include/simdutf/avx512.h +79 -0
- package/deps/simdutf/include/simdutf/base64_implementation.h +158 -0
- package/deps/simdutf/include/simdutf/base64_tables.h +887 -0
- package/deps/simdutf/include/simdutf/common_defs.h +186 -0
- package/deps/simdutf/include/simdutf/compiler_check.h +50 -0
- package/deps/simdutf/include/simdutf/constexpr_ptr.h +138 -0
- package/deps/simdutf/include/simdutf/encoding_types.h +189 -0
- package/deps/simdutf/include/simdutf/error.h +126 -0
- package/deps/simdutf/include/simdutf/implementation.h +7081 -0
- package/deps/simdutf/include/simdutf/internal/isadetection.h +325 -0
- package/deps/simdutf/include/simdutf/portability.h +285 -0
- package/deps/simdutf/include/simdutf/scalar/ascii.h +86 -0
- package/deps/simdutf/include/simdutf/scalar/atomic_util.h +105 -0
- package/deps/simdutf/include/simdutf/scalar/base64.h +911 -0
- package/deps/simdutf/include/simdutf/scalar/latin1.h +26 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf16/latin1_to_utf16.h +52 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf32/latin1_to_utf32.h +27 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf8/latin1_to_utf8.h +191 -0
- package/deps/simdutf/include/simdutf/scalar/swap_bytes.h +35 -0
- package/deps/simdutf/include/simdutf/scalar/utf16.h +226 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/utf16_to_latin1.h +108 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/valid_utf16_to_latin1.h +40 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/utf16_to_utf32.h +86 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/valid_utf16_to_utf32.h +44 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/utf16_to_utf8.h +295 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/valid_utf16_to_utf8.h +91 -0
- package/deps/simdutf/include/simdutf/scalar/utf32.h +82 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/utf32_to_latin1.h +68 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/valid_utf32_to_latin1.h +67 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/utf32_to_utf16.h +84 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/valid_utf32_to_utf16.h +44 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/utf32_to_utf8.h +142 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/valid_utf32_to_utf8.h +72 -0
- package/deps/simdutf/include/simdutf/scalar/utf8.h +326 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/utf8_to_latin1.h +225 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/valid_utf8_to_latin1.h +87 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/utf8_to_utf16.h +342 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/valid_utf8_to_utf16.h +106 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/utf8_to_utf32.h +299 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/valid_utf8_to_utf32.h +83 -0
- package/deps/simdutf/include/simdutf/simdutf_version.h +26 -0
- package/deps/simdutf/include/simdutf.h +26 -0
- package/deps/simdutf/include/simdutf_c.h +342 -0
- package/deps/simdutf/riscv/Dockerfile +16 -0
- package/deps/simdutf/riscv/README.md +24 -0
- package/deps/simdutf/riscv/remove-docker-station +8 -0
- package/deps/simdutf/riscv/run-docker-station +31 -0
- package/deps/simdutf/scripts/.flake8 +2 -0
- package/deps/simdutf/scripts/Makefile +2 -0
- package/deps/simdutf/scripts/README_ADD_FUNCTION.md +49 -0
- package/deps/simdutf/scripts/add_function.py +330 -0
- package/deps/simdutf/scripts/amalgamation_tests.py +156 -0
- package/deps/simdutf/scripts/base64/Makefile +2 -0
- package/deps/simdutf/scripts/base64/README.md +2 -0
- package/deps/simdutf/scripts/base64/avx512.py +76 -0
- package/deps/simdutf/scripts/base64/neon_decode.py +143 -0
- package/deps/simdutf/scripts/base64/neon_generate_lut.py +101 -0
- package/deps/simdutf/scripts/base64/sse.py +252 -0
- package/deps/simdutf/scripts/base64/sseregular.py +160 -0
- package/deps/simdutf/scripts/base64/sseurl.py +283 -0
- package/deps/simdutf/scripts/base64/table.py +59 -0
- package/deps/simdutf/scripts/base64bench_print.py +145 -0
- package/deps/simdutf/scripts/benchmark-all.py +119 -0
- package/deps/simdutf/scripts/benchmark_print.py +324 -0
- package/deps/simdutf/scripts/check_feature_macros.py +156 -0
- package/deps/simdutf/scripts/check_typos.sh +13 -0
- package/deps/simdutf/scripts/clang_format.sh +35 -0
- package/deps/simdutf/scripts/clang_format_docker.sh +38 -0
- package/deps/simdutf/scripts/common.py +24 -0
- package/deps/simdutf/scripts/compilation_benchmark.py +55 -0
- package/deps/simdutf/scripts/compile_many_variations.sh +64 -0
- package/deps/simdutf/scripts/create_latex_table.py +62 -0
- package/deps/simdutf/scripts/docker/Dockerfile +14 -0
- package/deps/simdutf/scripts/docker/Makefile +9 -0
- package/deps/simdutf/scripts/docker/README.md +30 -0
- package/deps/simdutf/scripts/docker/llvm.gpg +0 -0
- package/deps/simdutf/scripts/ppc64_convert_utf16_to_utf8.py +155 -0
- package/deps/simdutf/scripts/prepare_doxygen.sh +21 -0
- package/deps/simdutf/scripts/release.py +197 -0
- package/deps/simdutf/scripts/shortinputplots.py +97 -0
- package/deps/simdutf/scripts/sse_convert_utf16_to_utf8.py +422 -0
- package/deps/simdutf/scripts/sse_convert_utf32_to_utf16.py +105 -0
- package/deps/simdutf/scripts/sse_utf8_utf16_decode.py +186 -0
- package/deps/simdutf/scripts/sse_validate_utf16le_proof.py +137 -0
- package/deps/simdutf/scripts/sse_validate_utf16le_testcases.py +129 -0
- package/deps/simdutf/scripts/table.py +207 -0
- package/deps/simdutf/scripts/tests/new.txt +33 -0
- package/deps/simdutf/scripts/tests/old.txt +33 -0
- package/deps/simdutf/scripts/tests/results.txt +272 -0
- package/deps/simdutf/simdutf.pc.in +11 -0
- package/deps/simdutf/singleheader/.flake8 +2 -0
- package/deps/simdutf/singleheader/CMakeLists.txt +64 -0
- package/deps/simdutf/singleheader/README-dev.md +81 -0
- package/deps/simdutf/singleheader/README.md +19 -0
- package/deps/simdutf/singleheader/amalgamate.py +513 -0
- package/deps/simdutf/singleheader/amalgamation_demo.c +59 -0
- package/deps/simdutf/singleheader/amalgamation_demo.cpp +54 -0
- package/deps/simdutf/singleheader/test-features.py +262 -0
- package/deps/simdutf/src/CMakeLists.txt +78 -0
- package/deps/simdutf/src/arm64/arm_base64.cpp +791 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf16.cpp +24 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf32.cpp +24 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf8.cpp +70 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_latin1.cpp +61 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf32.cpp +185 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf8.cpp +780 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_latin1.cpp +60 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf16.cpp +208 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf8.cpp +505 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_latin1.cpp +69 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf16.cpp +313 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf32.cpp +179 -0
- package/deps/simdutf/src/arm64/arm_find.cpp +199 -0
- package/deps/simdutf/src/arm64/arm_utf16fix.cpp +185 -0
- package/deps/simdutf/src/arm64/arm_validate_utf16.cpp +165 -0
- package/deps/simdutf/src/arm64/arm_validate_utf32le.cpp +65 -0
- package/deps/simdutf/src/arm64/implementation.cpp +1442 -0
- package/deps/simdutf/src/encoding_types.cpp +67 -0
- package/deps/simdutf/src/error.cpp +3 -0
- package/deps/simdutf/src/fallback/implementation.cpp +589 -0
- package/deps/simdutf/src/generic/ascii_validation.h +50 -0
- package/deps/simdutf/src/generic/base64.h +233 -0
- package/deps/simdutf/src/generic/base64lengths.h +63 -0
- package/deps/simdutf/src/generic/buf_block_reader.h +109 -0
- package/deps/simdutf/src/generic/find.h +75 -0
- package/deps/simdutf/src/generic/utf16/change_endianness.h +24 -0
- package/deps/simdutf/src/generic/utf16/count_code_points_bytemask.h +58 -0
- package/deps/simdutf/src/generic/utf16/to_well_formed.h +93 -0
- package/deps/simdutf/src/generic/utf16/utf32_length_from_utf16.h +15 -0
- package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16.h +35 -0
- package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16_bytemask.h +199 -0
- package/deps/simdutf/src/generic/utf16.h +73 -0
- package/deps/simdutf/src/generic/utf32.h +136 -0
- package/deps/simdutf/src/generic/utf8/utf16_length_from_utf8_bytemask.h +53 -0
- package/deps/simdutf/src/generic/utf8.h +92 -0
- package/deps/simdutf/src/generic/utf8_to_latin1/utf8_to_latin1.h +316 -0
- package/deps/simdutf/src/generic/utf8_to_latin1/valid_utf8_to_latin1.h +78 -0
- package/deps/simdutf/src/generic/utf8_to_utf16/utf8_to_utf16.h +332 -0
- package/deps/simdutf/src/generic/utf8_to_utf16/valid_utf8_to_utf16.h +74 -0
- package/deps/simdutf/src/generic/utf8_to_utf32/utf8_to_utf32.h +318 -0
- package/deps/simdutf/src/generic/utf8_to_utf32/valid_utf8_to_utf32.h +42 -0
- package/deps/simdutf/src/generic/utf8_validation/utf8_lookup4_algorithm.h +223 -0
- package/deps/simdutf/src/generic/utf8_validation/utf8_validator.h +84 -0
- package/deps/simdutf/src/generic/validate_utf16.h +164 -0
- package/deps/simdutf/src/generic/validate_utf32.h +99 -0
- package/deps/simdutf/src/haswell/avx2_base64.cpp +837 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf16.cpp +28 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf32.cpp +20 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf8.cpp +83 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_latin1.cpp +83 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf32.cpp +210 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf8.cpp +602 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_latin1.cpp +116 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf16.cpp +164 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf8.cpp +569 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_latin1.cpp +60 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf16.cpp +195 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf32.cpp +135 -0
- package/deps/simdutf/src/haswell/avx2_utf16fix.cpp +173 -0
- package/deps/simdutf/src/haswell/avx2_validate_utf16.cpp +17 -0
- package/deps/simdutf/src/haswell/implementation.cpp +1447 -0
- package/deps/simdutf/src/icelake/icelake_ascii_validation.inl.cpp +19 -0
- package/deps/simdutf/src/icelake/icelake_base64.inl.cpp +630 -0
- package/deps/simdutf/src/icelake/icelake_common.inl.cpp +37 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf16.inl.cpp +36 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf32.inl.cpp +23 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf8.inl.cpp +107 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_latin1.inl.cpp +103 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf32.inl.cpp +136 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf8.inl.cpp +206 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_latin1.inl.cpp +74 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf16.inl.cpp +338 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf8.inl.cpp +574 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf8_to_latin1.inl.cpp +104 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf8_to_utf16.inl.cpp +75 -0
- package/deps/simdutf/src/icelake/icelake_convert_valid_utf8_to_latin1.inl.cpp +69 -0
- package/deps/simdutf/src/icelake/icelake_find.inl.cpp +146 -0
- package/deps/simdutf/src/icelake/icelake_from_utf8.inl.cpp +266 -0
- package/deps/simdutf/src/icelake/icelake_from_valid_utf8.inl.cpp +136 -0
- package/deps/simdutf/src/icelake/icelake_macros.inl.cpp +143 -0
- package/deps/simdutf/src/icelake/icelake_utf16fix.cpp +138 -0
- package/deps/simdutf/src/icelake/icelake_utf32_validation.inl.cpp +63 -0
- package/deps/simdutf/src/icelake/icelake_utf8_common.inl.cpp +753 -0
- package/deps/simdutf/src/icelake/icelake_utf8_length_from_utf16.inl.cpp +269 -0
- package/deps/simdutf/src/icelake/icelake_utf8_validation.inl.cpp +116 -0
- package/deps/simdutf/src/icelake/implementation.cpp +1903 -0
- package/deps/simdutf/src/implementation.cpp +2526 -0
- package/deps/simdutf/src/lasx/implementation.cpp +1531 -0
- package/deps/simdutf/src/lasx/lasx_base64.cpp +695 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf16.cpp +76 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf32.cpp +55 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf8.cpp +65 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_latin1.cpp +64 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf32.cpp +183 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf8.cpp +550 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_latin1.cpp +73 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf16.cpp +218 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf8.cpp +589 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_latin1.cpp +72 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf16.cpp +296 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf32.cpp +190 -0
- package/deps/simdutf/src/lasx/lasx_find.cpp +64 -0
- package/deps/simdutf/src/lasx/lasx_validate_utf16.cpp +13 -0
- package/deps/simdutf/src/lasx/lasx_validate_utf32le.cpp +84 -0
- package/deps/simdutf/src/lsx/implementation.cpp +1417 -0
- package/deps/simdutf/src/lsx/lsx_base64.cpp +675 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf16.cpp +39 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf32.cpp +27 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf8.cpp +56 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_latin1.cpp +64 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf32.cpp +133 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf8.cpp +518 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_latin1.cpp +66 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf16.cpp +155 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf8.cpp +459 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_latin1.cpp +75 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf16.cpp +291 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf32.cpp +179 -0
- package/deps/simdutf/src/lsx/lsx_find.cpp +60 -0
- package/deps/simdutf/src/lsx/lsx_validate_utf16.cpp +13 -0
- package/deps/simdutf/src/lsx/lsx_validate_utf32le.cpp +68 -0
- package/deps/simdutf/src/ppc64/implementation.cpp +992 -0
- package/deps/simdutf/src/ppc64/ppc64_base64.cpp +480 -0
- package/deps/simdutf/src/ppc64/ppc64_base64_internal_tests.cpp +401 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf16.cpp +12 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf32.cpp +12 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf8.cpp +149 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_latin1.cpp +67 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf32.cpp +87 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf8.cpp +296 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_latin1.cpp +57 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf16.cpp +117 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf8.cpp +166 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_latin1.cpp +69 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf16.cpp +211 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf32.cpp +153 -0
- package/deps/simdutf/src/ppc64/ppc64_utf16_to_utf8_tables.h +1011 -0
- package/deps/simdutf/src/ppc64/ppc64_utf8_length_from_latin1.cpp +37 -0
- package/deps/simdutf/src/ppc64/ppc64_validate_utf16.cpp +19 -0
- package/deps/simdutf/src/ppc64/templates.cpp +91 -0
- package/deps/simdutf/src/rvv/implementation.cpp +138 -0
- package/deps/simdutf/src/rvv/rvv_find.cpp +27 -0
- package/deps/simdutf/src/rvv/rvv_helpers.inl.cpp +23 -0
- package/deps/simdutf/src/rvv/rvv_latin1_to.inl.cpp +71 -0
- package/deps/simdutf/src/rvv/rvv_length_from.inl.cpp +164 -0
- package/deps/simdutf/src/rvv/rvv_utf16_to.inl.cpp +399 -0
- package/deps/simdutf/src/rvv/rvv_utf16fix.cpp +110 -0
- package/deps/simdutf/src/rvv/rvv_utf32_to.inl.cpp +307 -0
- package/deps/simdutf/src/rvv/rvv_utf8_to.inl.cpp +435 -0
- package/deps/simdutf/src/rvv/rvv_validate.inl.cpp +275 -0
- package/deps/simdutf/src/simdutf/arm64/begin.h +2 -0
- package/deps/simdutf/src/simdutf/arm64/bitmanipulation.h +34 -0
- package/deps/simdutf/src/simdutf/arm64/end.h +2 -0
- package/deps/simdutf/src/simdutf/arm64/implementation.h +307 -0
- package/deps/simdutf/src/simdutf/arm64/intrinsics.h +10 -0
- package/deps/simdutf/src/simdutf/arm64/simd.h +547 -0
- package/deps/simdutf/src/simdutf/arm64/simd16-inl.h +403 -0
- package/deps/simdutf/src/simdutf/arm64/simd32-inl.h +129 -0
- package/deps/simdutf/src/simdutf/arm64/simd64-inl.h +28 -0
- package/deps/simdutf/src/simdutf/arm64.h +43 -0
- package/deps/simdutf/src/simdutf/fallback/begin.h +1 -0
- package/deps/simdutf/src/simdutf/fallback/bitmanipulation.h +13 -0
- package/deps/simdutf/src/simdutf/fallback/end.h +1 -0
- package/deps/simdutf/src/simdutf/fallback/implementation.h +331 -0
- package/deps/simdutf/src/simdutf/fallback.h +42 -0
- package/deps/simdutf/src/simdutf/haswell/begin.h +15 -0
- package/deps/simdutf/src/simdutf/haswell/bitmanipulation.h +35 -0
- package/deps/simdutf/src/simdutf/haswell/end.h +13 -0
- package/deps/simdutf/src/simdutf/haswell/implementation.h +338 -0
- package/deps/simdutf/src/simdutf/haswell/intrinsics.h +67 -0
- package/deps/simdutf/src/simdutf/haswell/simd.h +363 -0
- package/deps/simdutf/src/simdutf/haswell/simd16-inl.h +261 -0
- package/deps/simdutf/src/simdutf/haswell/simd32-inl.h +111 -0
- package/deps/simdutf/src/simdutf/haswell/simd64-inl.h +34 -0
- package/deps/simdutf/src/simdutf/haswell.h +63 -0
- package/deps/simdutf/src/simdutf/icelake/begin.h +14 -0
- package/deps/simdutf/src/simdutf/icelake/bitmanipulation.h +44 -0
- package/deps/simdutf/src/simdutf/icelake/end.h +12 -0
- package/deps/simdutf/src/simdutf/icelake/implementation.h +346 -0
- package/deps/simdutf/src/simdutf/icelake/intrinsics.h +138 -0
- package/deps/simdutf/src/simdutf/icelake/simd.h +17 -0
- package/deps/simdutf/src/simdutf/icelake/simd16-inl.h +90 -0
- package/deps/simdutf/src/simdutf/icelake/simd32-inl.h +47 -0
- package/deps/simdutf/src/simdutf/icelake.h +81 -0
- package/deps/simdutf/src/simdutf/lasx/begin.h +8 -0
- package/deps/simdutf/src/simdutf/lasx/bitmanipulation.h +25 -0
- package/deps/simdutf/src/simdutf/lasx/end.h +8 -0
- package/deps/simdutf/src/simdutf/lasx/implementation.h +310 -0
- package/deps/simdutf/src/simdutf/lasx/intrinsics.h +319 -0
- package/deps/simdutf/src/simdutf/lasx/simd.h +551 -0
- package/deps/simdutf/src/simdutf/lasx/simd16-inl.h +234 -0
- package/deps/simdutf/src/simdutf/lasx/simd32-inl.h +74 -0
- package/deps/simdutf/src/simdutf/lasx/simd64-inl.h +52 -0
- package/deps/simdutf/src/simdutf/lasx.h +49 -0
- package/deps/simdutf/src/simdutf/lsx/begin.h +2 -0
- package/deps/simdutf/src/simdutf/lsx/bitmanipulation.h +25 -0
- package/deps/simdutf/src/simdutf/lsx/end.h +2 -0
- package/deps/simdutf/src/simdutf/lsx/implementation.h +309 -0
- package/deps/simdutf/src/simdutf/lsx/intrinsics.h +196 -0
- package/deps/simdutf/src/simdutf/lsx/simd.h +421 -0
- package/deps/simdutf/src/simdutf/lsx/simd16-inl.h +242 -0
- package/deps/simdutf/src/simdutf/lsx/simd32-inl.h +69 -0
- package/deps/simdutf/src/simdutf/lsx/simd64-inl.h +50 -0
- package/deps/simdutf/src/simdutf/lsx.h +52 -0
- package/deps/simdutf/src/simdutf/ppc64/begin.h +1 -0
- package/deps/simdutf/src/simdutf/ppc64/bitmanipulation.h +29 -0
- package/deps/simdutf/src/simdutf/ppc64/end.h +1 -0
- package/deps/simdutf/src/simdutf/ppc64/implementation.h +348 -0
- package/deps/simdutf/src/simdutf/ppc64/intrinsics.h +19 -0
- package/deps/simdutf/src/simdutf/ppc64/simd.h +177 -0
- package/deps/simdutf/src/simdutf/ppc64/simd16-inl.h +327 -0
- package/deps/simdutf/src/simdutf/ppc64/simd32-inl.h +247 -0
- package/deps/simdutf/src/simdutf/ppc64/simd8-inl.h +618 -0
- package/deps/simdutf/src/simdutf/ppc64.h +40 -0
- package/deps/simdutf/src/simdutf/rvv/begin.h +7 -0
- package/deps/simdutf/src/simdutf/rvv/end.h +7 -0
- package/deps/simdutf/src/simdutf/rvv/implementation.h +321 -0
- package/deps/simdutf/src/simdutf/rvv/intrinsics.h +131 -0
- package/deps/simdutf/src/simdutf/rvv.h +41 -0
- package/deps/simdutf/src/simdutf/westmere/begin.h +8 -0
- package/deps/simdutf/src/simdutf/westmere/bitmanipulation.h +37 -0
- package/deps/simdutf/src/simdutf/westmere/end.h +8 -0
- package/deps/simdutf/src/simdutf/westmere/implementation.h +338 -0
- package/deps/simdutf/src/simdutf/westmere/intrinsics.h +38 -0
- package/deps/simdutf/src/simdutf/westmere/simd.h +379 -0
- package/deps/simdutf/src/simdutf/westmere/simd16-inl.h +242 -0
- package/deps/simdutf/src/simdutf/westmere/simd32-inl.h +151 -0
- package/deps/simdutf/src/simdutf/westmere/simd64-inl.h +33 -0
- package/deps/simdutf/src/simdutf/westmere.h +59 -0
- package/deps/simdutf/src/simdutf.cpp +152 -0
- package/deps/simdutf/src/simdutf_c.cpp +525 -0
- package/deps/simdutf/src/tables/utf16_to_utf8_tables.h +768 -0
- package/deps/simdutf/src/tables/utf32_to_utf16_tables.h +53 -0
- package/deps/simdutf/src/tables/utf8_to_utf16_tables.h +826 -0
- package/deps/simdutf/src/westmere/implementation.cpp +1479 -0
- package/deps/simdutf/src/westmere/internal/loader.cpp +7 -0
- package/deps/simdutf/src/westmere/internal/write_v_u16_11bits_to_utf8.cpp +66 -0
- package/deps/simdutf/src/westmere/sse_base64.cpp +672 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf16.cpp +21 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf32.cpp +31 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf8.cpp +71 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_latin1.cpp +70 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf32.cpp +206 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf8.cpp +504 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_latin1.cpp +82 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf16.cpp +209 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf8.cpp +589 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_latin1.cpp +58 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf16.cpp +197 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf32.cpp +141 -0
- package/deps/simdutf/src/westmere/sse_utf16fix.cpp +82 -0
- package/deps/simdutf/src/westmere/sse_validate_utf16.cpp +17 -0
- package/deps/simdutf/tests/CMakeLists.txt +483 -0
- package/deps/simdutf/tests/atomic_base64_tests.cpp +2845 -0
- package/deps/simdutf/tests/base64_tests.cpp +3617 -0
- package/deps/simdutf/tests/basic_fuzzer.cpp +805 -0
- package/deps/simdutf/tests/bele_tests.cpp +182 -0
- package/deps/simdutf/tests/constexpr_base64_tests.cpp +387 -0
- package/deps/simdutf/tests/convert_latin1_to_utf16be_tests.cpp +52 -0
- package/deps/simdutf/tests/convert_latin1_to_utf16le_tests.cpp +80 -0
- package/deps/simdutf/tests/convert_latin1_to_utf32_tests.cpp +66 -0
- package/deps/simdutf/tests/convert_latin1_to_utf8_tests.cpp +120 -0
- package/deps/simdutf/tests/convert_utf16_to_utf8_safe_tests.cpp +203 -0
- package/deps/simdutf/tests/convert_utf16_to_utf8_with_replacement_tests.cpp +276 -0
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests.cpp +109 -0
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests_with_errors.cpp +136 -0
- package/deps/simdutf/tests/convert_utf16be_to_utf32_tests.cpp +193 -0
- package/deps/simdutf/tests/convert_utf16be_to_utf32_with_errors_tests.cpp +381 -0
- package/deps/simdutf/tests/convert_utf16be_to_utf8_tests.cpp +259 -0
- package/deps/simdutf/tests/convert_utf16be_to_utf8_with_errors_tests.cpp +266 -0
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests.cpp +148 -0
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests_with_errors.cpp +176 -0
- package/deps/simdutf/tests/convert_utf16le_to_utf32_tests.cpp +213 -0
- package/deps/simdutf/tests/convert_utf16le_to_utf32_with_errors_tests.cpp +318 -0
- package/deps/simdutf/tests/convert_utf16le_to_utf8_tests.cpp +343 -0
- package/deps/simdutf/tests/convert_utf16le_to_utf8_with_errors_tests.cpp +271 -0
- package/deps/simdutf/tests/convert_utf32_to_latin1_tests.cpp +111 -0
- package/deps/simdutf/tests/convert_utf32_to_latin1_with_errors_tests.cpp +96 -0
- package/deps/simdutf/tests/convert_utf32_to_utf16be_tests.cpp +148 -0
- package/deps/simdutf/tests/convert_utf32_to_utf16be_with_errors_tests.cpp +192 -0
- package/deps/simdutf/tests/convert_utf32_to_utf16le_tests.cpp +166 -0
- package/deps/simdutf/tests/convert_utf32_to_utf16le_with_errors_tests.cpp +215 -0
- package/deps/simdutf/tests/convert_utf32_to_utf8_tests.cpp +181 -0
- package/deps/simdutf/tests/convert_utf32_to_utf8_with_errors_tests.cpp +261 -0
- package/deps/simdutf/tests/convert_utf8_to_latin1_tests.cpp +516 -0
- package/deps/simdutf/tests/convert_utf8_to_latin1_with_errors_tests.cpp +579 -0
- package/deps/simdutf/tests/convert_utf8_to_utf16be_tests.cpp +412 -0
- package/deps/simdutf/tests/convert_utf8_to_utf16be_with_errors_tests.cpp +480 -0
- package/deps/simdutf/tests/convert_utf8_to_utf16le_tests.cpp +671 -0
- package/deps/simdutf/tests/convert_utf8_to_utf16le_with_errors_tests.cpp +455 -0
- package/deps/simdutf/tests/convert_utf8_to_utf32_tests.cpp +1204 -0
- package/deps/simdutf/tests/convert_utf8_to_utf32_with_errors_tests.cpp +337 -0
- package/deps/simdutf/tests/convert_valid_utf16be_to_latin1_tests.cpp +37 -0
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf32_tests.cpp +97 -0
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf8_tests.cpp +126 -0
- package/deps/simdutf/tests/convert_valid_utf16le_to_latin1_tests.cpp +71 -0
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf32_tests.cpp +122 -0
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf8_tests.cpp +244 -0
- package/deps/simdutf/tests/convert_valid_utf32_to_latin1_tests.cpp +49 -0
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16be_tests.cpp +92 -0
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16le_tests.cpp +114 -0
- package/deps/simdutf/tests/convert_valid_utf32_to_utf8_tests.cpp +109 -0
- package/deps/simdutf/tests/convert_valid_utf8_to_latin1_tests.cpp +84 -0
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16be_tests.cpp +124 -0
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16le_tests.cpp +221 -0
- package/deps/simdutf/tests/convert_valid_utf8_to_utf32_tests.cpp +155 -0
- package/deps/simdutf/tests/count_utf16be.cpp +64 -0
- package/deps/simdutf/tests/count_utf16le.cpp +61 -0
- package/deps/simdutf/tests/count_utf8.cpp +87 -0
- package/deps/simdutf/tests/detect_encodings_tests.cpp +312 -0
- package/deps/simdutf/tests/embed/valid_utf8.txt +1 -0
- package/deps/simdutf/tests/embed_tests.cpp +22 -0
- package/deps/simdutf/tests/find_tests.cpp +77 -0
- package/deps/simdutf/tests/fixed_string_tests.cpp +153 -0
- package/deps/simdutf/tests/helpers/CMakeLists.txt +25 -0
- package/deps/simdutf/tests/helpers/compiletime_conversions.h +222 -0
- package/deps/simdutf/tests/helpers/fixed_string.h +267 -0
- package/deps/simdutf/tests/helpers/random_int.cpp +30 -0
- package/deps/simdutf/tests/helpers/random_int.h +39 -0
- package/deps/simdutf/tests/helpers/random_utf16.cpp +123 -0
- package/deps/simdutf/tests/helpers/random_utf16.h +52 -0
- package/deps/simdutf/tests/helpers/random_utf32.cpp +41 -0
- package/deps/simdutf/tests/helpers/random_utf32.h +40 -0
- package/deps/simdutf/tests/helpers/random_utf8.cpp +93 -0
- package/deps/simdutf/tests/helpers/random_utf8.h +36 -0
- package/deps/simdutf/tests/helpers/test.cpp +231 -0
- package/deps/simdutf/tests/helpers/test.h +193 -0
- package/deps/simdutf/tests/helpers/transcode_test_base.cpp +1257 -0
- package/deps/simdutf/tests/helpers/transcode_test_base.h +683 -0
- package/deps/simdutf/tests/helpers/utf16.h +27 -0
- package/deps/simdutf/tests/installation_tests/find/CMakeLists.txt +43 -0
- package/deps/simdutf/tests/installation_tests/from_fetch/CMakeLists.txt +47 -0
- package/deps/simdutf/tests/internal_tests.cpp +27 -0
- package/deps/simdutf/tests/null_safety_tests.cpp +94 -0
- package/deps/simdutf/tests/random_fuzzer.cpp +779 -0
- package/deps/simdutf/tests/readme_tests.cpp +274 -0
- package/deps/simdutf/tests/reference/CMakeLists.txt +23 -0
- package/deps/simdutf/tests/reference/decode_utf16.h +81 -0
- package/deps/simdutf/tests/reference/decode_utf32.h +47 -0
- package/deps/simdutf/tests/reference/encode_latin1.cpp +1 -0
- package/deps/simdutf/tests/reference/encode_latin1.h +32 -0
- package/deps/simdutf/tests/reference/encode_utf16.cpp +49 -0
- package/deps/simdutf/tests/reference/encode_utf16.h +20 -0
- package/deps/simdutf/tests/reference/encode_utf32.cpp +1 -0
- package/deps/simdutf/tests/reference/encode_utf32.h +36 -0
- package/deps/simdutf/tests/reference/encode_utf8.cpp +1 -0
- package/deps/simdutf/tests/reference/encode_utf8.h +40 -0
- package/deps/simdutf/tests/reference/validate_utf16.cpp +60 -0
- package/deps/simdutf/tests/reference/validate_utf16.h +14 -0
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.cpp +35 -0
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.h +13 -0
- package/deps/simdutf/tests/reference/validate_utf32.cpp +27 -0
- package/deps/simdutf/tests/reference/validate_utf32.h +12 -0
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.cpp +27 -0
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.h +12 -0
- package/deps/simdutf/tests/reference/validate_utf8.cpp +82 -0
- package/deps/simdutf/tests/reference/validate_utf8.h +11 -0
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.cpp +43 -0
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.h +12 -0
- package/deps/simdutf/tests/select_implementation.cpp +43 -0
- package/deps/simdutf/tests/simdutf_c_tests.cpp +244 -0
- package/deps/simdutf/tests/span_tests.cpp +401 -0
- package/deps/simdutf/tests/special_tests.cpp +559 -0
- package/deps/simdutf/tests/straight_c_test.c +187 -0
- package/deps/simdutf/tests/text_encoding_tests.cpp +77 -0
- package/deps/simdutf/tests/to_well_formed_utf16_tests.cpp +377 -0
- package/deps/simdutf/tests/utf8_length_from_utf16_tests.cpp +202 -0
- package/deps/simdutf/tests/validate_ascii_basic_tests.cpp +165 -0
- package/deps/simdutf/tests/validate_ascii_with_errors_tests.cpp +77 -0
- package/deps/simdutf/tests/validate_utf16be_basic_tests.cpp +175 -0
- package/deps/simdutf/tests/validate_utf16be_with_errors_tests.cpp +188 -0
- package/deps/simdutf/tests/validate_utf16le_basic_tests.cpp +268 -0
- package/deps/simdutf/tests/validate_utf16le_with_errors_tests.cpp +274 -0
- package/deps/simdutf/tests/validate_utf32_basic_tests.cpp +92 -0
- package/deps/simdutf/tests/validate_utf32_with_errors_tests.cpp +114 -0
- package/deps/simdutf/tests/validate_utf8_basic_tests.cpp +178 -0
- package/deps/simdutf/tests/validate_utf8_brute_force_tests.cpp +88 -0
- package/deps/simdutf/tests/validate_utf8_puzzler_tests.cpp +33 -0
- package/deps/simdutf/tests/validate_utf8_with_errors_tests.cpp +228 -0
- package/deps/simdutf/tools/CMakeLists.txt +85 -0
- package/deps/simdutf/tools/fastbase64.cpp +250 -0
- package/deps/simdutf/tools/sutf.cpp +556 -0
- package/deps/simdutf/tools/sutf.h +40 -0
- package/lib/commonjs/blake3.js +2 -1
- package/lib/commonjs/blake3.js.map +1 -1
- package/lib/commonjs/diffie-hellman.js +5 -4
- package/lib/commonjs/diffie-hellman.js.map +1 -1
- package/lib/commonjs/ecdh.js +5 -4
- package/lib/commonjs/ecdh.js.map +1 -1
- package/lib/module/blake3.js +2 -1
- package/lib/module/blake3.js.map +1 -1
- package/lib/module/diffie-hellman.js +5 -4
- package/lib/module/diffie-hellman.js.map +1 -1
- package/lib/module/ecdh.js +5 -4
- package/lib/module/ecdh.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/blake3.d.ts.map +1 -1
- package/lib/typescript/diffie-hellman.d.ts.map +1 -1
- package/lib/typescript/ecdh.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/blake3.ts +2 -1
- package/src/diffie-hellman.ts +5 -7
- package/src/ecdh.ts +5 -8
|
@@ -0,0 +1,2526 @@
|
|
|
1
|
+
#include "simdutf.h"
|
|
2
|
+
#include <initializer_list>
|
|
3
|
+
#include <climits>
|
|
4
|
+
#include <type_traits>
|
|
5
|
+
#if SIMDUTF_ATOMIC_REF
|
|
6
|
+
#include <array>
|
|
7
|
+
#include "simdutf/scalar/atomic_util.h"
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
static_assert(sizeof(uint8_t) == sizeof(char),
|
|
11
|
+
"simdutf requires that uint8_t be a char");
|
|
12
|
+
static_assert(sizeof(uint16_t) == sizeof(char16_t),
|
|
13
|
+
"simdutf requires that char16_t be 16 bits");
|
|
14
|
+
static_assert(sizeof(uint32_t) == sizeof(char32_t),
|
|
15
|
+
"simdutf requires that char32_t be 32 bits");
|
|
16
|
+
// next line is redundant, but it is kept to catch defective systems.
|
|
17
|
+
static_assert(CHAR_BIT == 8, "simdutf requires 8-bit bytes");
|
|
18
|
+
|
|
19
|
+
// Useful for debugging purposes
|
|
20
|
+
namespace simdutf {
|
|
21
|
+
namespace {
|
|
22
|
+
|
|
23
|
+
template <typename T> std::string toBinaryString(T b) {
|
|
24
|
+
std::string binary = "";
|
|
25
|
+
T mask = T(1) << (sizeof(T) * CHAR_BIT - 1);
|
|
26
|
+
while (mask > 0) {
|
|
27
|
+
binary += ((b & mask) == 0) ? '0' : '1';
|
|
28
|
+
mask >>= 1;
|
|
29
|
+
}
|
|
30
|
+
return binary;
|
|
31
|
+
}
|
|
32
|
+
} // namespace
|
|
33
|
+
} // namespace simdutf
|
|
34
|
+
|
|
35
|
+
namespace simdutf {
|
|
36
|
+
bool implementation::supported_by_runtime_system() const {
|
|
37
|
+
uint32_t required_instruction_sets = this->required_instruction_sets();
|
|
38
|
+
uint32_t supported_instruction_sets =
|
|
39
|
+
internal::detect_supported_architectures();
|
|
40
|
+
return ((supported_instruction_sets & required_instruction_sets) ==
|
|
41
|
+
required_instruction_sets);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#if SIMDUTF_FEATURE_DETECT_ENCODING
|
|
45
|
+
simdutf_warn_unused encoding_type implementation::autodetect_encoding(
|
|
46
|
+
const char *input, size_t length) const noexcept {
|
|
47
|
+
// If there is a BOM, then we trust it.
|
|
48
|
+
auto bom_encoding = simdutf::BOM::check_bom(input, length);
|
|
49
|
+
if (bom_encoding != encoding_type::unspecified) {
|
|
50
|
+
return bom_encoding;
|
|
51
|
+
}
|
|
52
|
+
// UTF8 is common, it includes ASCII, and is commonly represented
|
|
53
|
+
// without a BOM, so if it fits, go with that. Note that it is still
|
|
54
|
+
// possible to get it wrong, we are only 'guessing'. If some has UTF-16
|
|
55
|
+
// data without a BOM, it could pass as UTF-8.
|
|
56
|
+
//
|
|
57
|
+
// An interesting twist might be to check for UTF-16 ASCII first (every
|
|
58
|
+
// other byte is zero).
|
|
59
|
+
if (validate_utf8(input, length)) {
|
|
60
|
+
return encoding_type::UTF8;
|
|
61
|
+
}
|
|
62
|
+
// The next most common encoding that might appear without BOM is probably
|
|
63
|
+
// UTF-16LE, so try that next.
|
|
64
|
+
if ((length % 2) == 0) {
|
|
65
|
+
// important: we need to divide by two
|
|
66
|
+
if (validate_utf16le(reinterpret_cast<const char16_t *>(input),
|
|
67
|
+
length / 2)) {
|
|
68
|
+
return encoding_type::UTF16_LE;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if ((length % 4) == 0) {
|
|
72
|
+
if (validate_utf32(reinterpret_cast<const char32_t *>(input), length / 4)) {
|
|
73
|
+
return encoding_type::UTF32_LE;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return encoding_type::unspecified;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#ifdef SIMDUTF_INTERNAL_TESTS
|
|
80
|
+
std::vector<implementation::TestProcedure>
|
|
81
|
+
implementation::internal_tests() const {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
#endif // SIMDUTF_FEATURE_DETECT_ENCODING
|
|
86
|
+
|
|
87
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
88
|
+
simdutf_warn_unused size_t implementation::maximal_binary_length_from_base64(
|
|
89
|
+
const char *input, size_t length) const noexcept {
|
|
90
|
+
return scalar::base64::maximal_binary_length_from_base64(input, length);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
simdutf_warn_unused size_t implementation::maximal_binary_length_from_base64(
|
|
94
|
+
const char16_t *input, size_t length) const noexcept {
|
|
95
|
+
return scalar::base64::maximal_binary_length_from_base64(input, length);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
simdutf_warn_unused size_t implementation::binary_length_from_base64(
|
|
99
|
+
const char *input, size_t length) const noexcept {
|
|
100
|
+
return scalar::base64::binary_length_from_base64(input, length);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
simdutf_warn_unused size_t implementation::binary_length_from_base64(
|
|
104
|
+
const char16_t *input, size_t length) const noexcept {
|
|
105
|
+
return scalar::base64::binary_length_from_base64(input, length);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
simdutf_warn_unused size_t implementation::base64_length_from_binary(
|
|
109
|
+
size_t length, base64_options options) const noexcept {
|
|
110
|
+
return scalar::base64::base64_length_from_binary(length, options);
|
|
111
|
+
}
|
|
112
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
113
|
+
|
|
114
|
+
namespace internal {
|
|
115
|
+
// When there is a single implementation, we should not pay a price
|
|
116
|
+
// for dispatching to the best implementation. We should just use the
|
|
117
|
+
// one we have. This is a compile-time check.
|
|
118
|
+
#define SIMDUTF_SINGLE_IMPLEMENTATION \
|
|
119
|
+
(SIMDUTF_IMPLEMENTATION_ICELAKE + SIMDUTF_IMPLEMENTATION_HASWELL + \
|
|
120
|
+
SIMDUTF_IMPLEMENTATION_WESTMERE + SIMDUTF_IMPLEMENTATION_ARM64 + \
|
|
121
|
+
SIMDUTF_IMPLEMENTATION_PPC64 + SIMDUTF_IMPLEMENTATION_LSX + \
|
|
122
|
+
SIMDUTF_IMPLEMENTATION_LASX + SIMDUTF_IMPLEMENTATION_FALLBACK == \
|
|
123
|
+
1)
|
|
124
|
+
|
|
125
|
+
// Static array of known implementations. We are hoping these get baked into the
|
|
126
|
+
// executable without requiring a static initializer.
|
|
127
|
+
|
|
128
|
+
#if SIMDUTF_IMPLEMENTATION_ICELAKE
|
|
129
|
+
static const icelake::implementation *get_icelake_singleton() {
|
|
130
|
+
static const icelake::implementation icelake_singleton{};
|
|
131
|
+
return &icelake_singleton;
|
|
132
|
+
}
|
|
133
|
+
#endif
|
|
134
|
+
#if SIMDUTF_IMPLEMENTATION_HASWELL
|
|
135
|
+
static const haswell::implementation *get_haswell_singleton() {
|
|
136
|
+
static const haswell::implementation haswell_singleton{};
|
|
137
|
+
return &haswell_singleton;
|
|
138
|
+
}
|
|
139
|
+
#endif
|
|
140
|
+
#if SIMDUTF_IMPLEMENTATION_WESTMERE
|
|
141
|
+
static const westmere::implementation *get_westmere_singleton() {
|
|
142
|
+
static const westmere::implementation westmere_singleton{};
|
|
143
|
+
return &westmere_singleton;
|
|
144
|
+
}
|
|
145
|
+
#endif
|
|
146
|
+
#if SIMDUTF_IMPLEMENTATION_ARM64
|
|
147
|
+
static const arm64::implementation *get_arm64_singleton() {
|
|
148
|
+
static const arm64::implementation arm64_singleton{};
|
|
149
|
+
return &arm64_singleton;
|
|
150
|
+
}
|
|
151
|
+
#endif
|
|
152
|
+
#if SIMDUTF_IMPLEMENTATION_PPC64
|
|
153
|
+
static const ppc64::implementation *get_ppc64_singleton() {
|
|
154
|
+
static const ppc64::implementation ppc64_singleton{};
|
|
155
|
+
return &ppc64_singleton;
|
|
156
|
+
}
|
|
157
|
+
#endif
|
|
158
|
+
#if SIMDUTF_IMPLEMENTATION_RVV
|
|
159
|
+
static const rvv::implementation *get_rvv_singleton() {
|
|
160
|
+
static const rvv::implementation rvv_singleton{};
|
|
161
|
+
return &rvv_singleton;
|
|
162
|
+
}
|
|
163
|
+
#endif
|
|
164
|
+
#if SIMDUTF_IMPLEMENTATION_LASX
|
|
165
|
+
static const lasx::implementation *get_lasx_singleton() {
|
|
166
|
+
static const lasx::implementation lasx_singleton{};
|
|
167
|
+
return &lasx_singleton;
|
|
168
|
+
}
|
|
169
|
+
#endif
|
|
170
|
+
#if SIMDUTF_IMPLEMENTATION_LSX
|
|
171
|
+
static const lsx::implementation *get_lsx_singleton() {
|
|
172
|
+
static const lsx::implementation lsx_singleton{};
|
|
173
|
+
return &lsx_singleton;
|
|
174
|
+
}
|
|
175
|
+
#endif
|
|
176
|
+
#if SIMDUTF_IMPLEMENTATION_FALLBACK
|
|
177
|
+
static const fallback::implementation *get_fallback_singleton() {
|
|
178
|
+
static const fallback::implementation fallback_singleton{};
|
|
179
|
+
return &fallback_singleton;
|
|
180
|
+
}
|
|
181
|
+
#endif
|
|
182
|
+
|
|
183
|
+
#if SIMDUTF_SINGLE_IMPLEMENTATION
|
|
184
|
+
simdutf_really_inline static const implementation *get_single_implementation() {
|
|
185
|
+
return
|
|
186
|
+
#if SIMDUTF_IMPLEMENTATION_ICELAKE
|
|
187
|
+
get_icelake_singleton();
|
|
188
|
+
#endif
|
|
189
|
+
#if SIMDUTF_IMPLEMENTATION_HASWELL
|
|
190
|
+
get_haswell_singleton();
|
|
191
|
+
#endif
|
|
192
|
+
#if SIMDUTF_IMPLEMENTATION_WESTMERE
|
|
193
|
+
get_westmere_singleton();
|
|
194
|
+
#endif
|
|
195
|
+
#if SIMDUTF_IMPLEMENTATION_ARM64
|
|
196
|
+
get_arm64_singleton();
|
|
197
|
+
#endif
|
|
198
|
+
#if SIMDUTF_IMPLEMENTATION_PPC64
|
|
199
|
+
get_ppc64_singleton();
|
|
200
|
+
#endif
|
|
201
|
+
#if SIMDUTF_IMPLEMENTATION_LASX
|
|
202
|
+
get_lasx_singleton();
|
|
203
|
+
#endif
|
|
204
|
+
#if SIMDUTF_IMPLEMENTATION_LSX
|
|
205
|
+
get_lsx_singleton();
|
|
206
|
+
#endif
|
|
207
|
+
#if SIMDUTF_IMPLEMENTATION_FALLBACK
|
|
208
|
+
get_fallback_singleton();
|
|
209
|
+
#endif
|
|
210
|
+
}
|
|
211
|
+
#endif
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @private Detects best supported implementation on first use, and sets it
|
|
215
|
+
*/
|
|
216
|
+
class detect_best_supported_implementation_on_first_use final
|
|
217
|
+
: public implementation {
|
|
218
|
+
public:
|
|
219
|
+
std::string name() const noexcept final { return set_best()->name(); }
|
|
220
|
+
std::string description() const noexcept final {
|
|
221
|
+
return set_best()->description();
|
|
222
|
+
}
|
|
223
|
+
uint32_t required_instruction_sets() const noexcept final {
|
|
224
|
+
return set_best()->required_instruction_sets();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#if SIMDUTF_FEATURE_DETECT_ENCODING
|
|
228
|
+
simdutf_warn_unused int
|
|
229
|
+
detect_encodings(const char *input, size_t length) const noexcept override {
|
|
230
|
+
return set_best()->detect_encodings(input, length);
|
|
231
|
+
}
|
|
232
|
+
#endif // SIMDUTF_FEATURE_DETECT_ENCODING
|
|
233
|
+
|
|
234
|
+
#if SIMDUTF_FEATURE_UTF8 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
235
|
+
simdutf_warn_unused bool
|
|
236
|
+
validate_utf8(const char *buf, size_t len) const noexcept final override {
|
|
237
|
+
return set_best()->validate_utf8(buf, len);
|
|
238
|
+
}
|
|
239
|
+
#endif // SIMDUTF_FEATURE_UTF8 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
240
|
+
|
|
241
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
242
|
+
simdutf_warn_unused result validate_utf8_with_errors(
|
|
243
|
+
const char *buf, size_t len) const noexcept final override {
|
|
244
|
+
return set_best()->validate_utf8_with_errors(buf, len);
|
|
245
|
+
}
|
|
246
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
247
|
+
|
|
248
|
+
#if SIMDUTF_FEATURE_ASCII
|
|
249
|
+
simdutf_warn_unused bool
|
|
250
|
+
validate_ascii(const char *buf, size_t len) const noexcept final override {
|
|
251
|
+
return set_best()->validate_ascii(buf, len);
|
|
252
|
+
}
|
|
253
|
+
simdutf_warn_unused result validate_ascii_with_errors(
|
|
254
|
+
const char *buf, size_t len) const noexcept final override {
|
|
255
|
+
return set_best()->validate_ascii_with_errors(buf, len);
|
|
256
|
+
}
|
|
257
|
+
#endif // SIMDUTF_FEATURE_ASCII
|
|
258
|
+
|
|
259
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
260
|
+
simdutf_warn_unused bool
|
|
261
|
+
validate_utf16le_as_ascii(const char16_t *buf,
|
|
262
|
+
size_t len) const noexcept final override {
|
|
263
|
+
return set_best()->validate_utf16le_as_ascii(buf, len);
|
|
264
|
+
}
|
|
265
|
+
simdutf_warn_unused bool
|
|
266
|
+
validate_utf16be_as_ascii(const char16_t *buf,
|
|
267
|
+
size_t len) const noexcept final override {
|
|
268
|
+
return set_best()->validate_utf16be_as_ascii(buf, len);
|
|
269
|
+
}
|
|
270
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
271
|
+
|
|
272
|
+
#if SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
273
|
+
simdutf_warn_unused bool
|
|
274
|
+
validate_utf16le(const char16_t *buf,
|
|
275
|
+
size_t len) const noexcept final override {
|
|
276
|
+
return set_best()->validate_utf16le(buf, len);
|
|
277
|
+
}
|
|
278
|
+
#endif // SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
279
|
+
|
|
280
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
281
|
+
simdutf_warn_unused bool
|
|
282
|
+
validate_utf16be(const char16_t *buf,
|
|
283
|
+
size_t len) const noexcept final override {
|
|
284
|
+
return set_best()->validate_utf16be(buf, len);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
simdutf_warn_unused result validate_utf16le_with_errors(
|
|
288
|
+
const char16_t *buf, size_t len) const noexcept final override {
|
|
289
|
+
return set_best()->validate_utf16le_with_errors(buf, len);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
simdutf_warn_unused result validate_utf16be_with_errors(
|
|
293
|
+
const char16_t *buf, size_t len) const noexcept final override {
|
|
294
|
+
return set_best()->validate_utf16be_with_errors(buf, len);
|
|
295
|
+
}
|
|
296
|
+
void to_well_formed_utf16be(const char16_t *input, size_t len,
|
|
297
|
+
char16_t *output) const noexcept final override {
|
|
298
|
+
return set_best()->to_well_formed_utf16be(input, len, output);
|
|
299
|
+
}
|
|
300
|
+
void to_well_formed_utf16le(const char16_t *input, size_t len,
|
|
301
|
+
char16_t *output) const noexcept final override {
|
|
302
|
+
return set_best()->to_well_formed_utf16le(input, len, output);
|
|
303
|
+
}
|
|
304
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
305
|
+
|
|
306
|
+
#if SIMDUTF_FEATURE_UTF32 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
307
|
+
simdutf_warn_unused bool
|
|
308
|
+
validate_utf32(const char32_t *buf,
|
|
309
|
+
size_t len) const noexcept final override {
|
|
310
|
+
return set_best()->validate_utf32(buf, len);
|
|
311
|
+
}
|
|
312
|
+
#endif // SIMDUTF_FEATURE_UTF32 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
313
|
+
|
|
314
|
+
#if SIMDUTF_FEATURE_UTF32
|
|
315
|
+
simdutf_warn_unused result validate_utf32_with_errors(
|
|
316
|
+
const char32_t *buf, size_t len) const noexcept final override {
|
|
317
|
+
return set_best()->validate_utf32_with_errors(buf, len);
|
|
318
|
+
}
|
|
319
|
+
#endif // SIMDUTF_FEATURE_UTF32
|
|
320
|
+
|
|
321
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
322
|
+
simdutf_warn_unused size_t
|
|
323
|
+
convert_latin1_to_utf8(const char *buf, size_t len,
|
|
324
|
+
char *utf8_output) const noexcept final override {
|
|
325
|
+
return set_best()->convert_latin1_to_utf8(buf, len, utf8_output);
|
|
326
|
+
}
|
|
327
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
328
|
+
|
|
329
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
330
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16le(
|
|
331
|
+
const char *buf, size_t len,
|
|
332
|
+
char16_t *utf16_output) const noexcept final override {
|
|
333
|
+
return set_best()->convert_latin1_to_utf16le(buf, len, utf16_output);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16be(
|
|
337
|
+
const char *buf, size_t len,
|
|
338
|
+
char16_t *utf16_output) const noexcept final override {
|
|
339
|
+
return set_best()->convert_latin1_to_utf16be(buf, len, utf16_output);
|
|
340
|
+
}
|
|
341
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
342
|
+
|
|
343
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
344
|
+
simdutf_warn_unused size_t convert_latin1_to_utf32(
|
|
345
|
+
const char *buf, size_t len,
|
|
346
|
+
char32_t *latin1_output) const noexcept final override {
|
|
347
|
+
return set_best()->convert_latin1_to_utf32(buf, len, latin1_output);
|
|
348
|
+
}
|
|
349
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
350
|
+
|
|
351
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
352
|
+
simdutf_warn_unused size_t
|
|
353
|
+
convert_utf8_to_latin1(const char *buf, size_t len,
|
|
354
|
+
char *latin1_output) const noexcept final override {
|
|
355
|
+
return set_best()->convert_utf8_to_latin1(buf, len, latin1_output);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
simdutf_warn_unused result convert_utf8_to_latin1_with_errors(
|
|
359
|
+
const char *buf, size_t len,
|
|
360
|
+
char *latin1_output) const noexcept final override {
|
|
361
|
+
return set_best()->convert_utf8_to_latin1_with_errors(buf, len,
|
|
362
|
+
latin1_output);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_latin1(
|
|
366
|
+
const char *buf, size_t len,
|
|
367
|
+
char *latin1_output) const noexcept final override {
|
|
368
|
+
return set_best()->convert_valid_utf8_to_latin1(buf, len, latin1_output);
|
|
369
|
+
}
|
|
370
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
371
|
+
|
|
372
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
373
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16le(
|
|
374
|
+
const char *buf, size_t len,
|
|
375
|
+
char16_t *utf16_output) const noexcept final override {
|
|
376
|
+
return set_best()->convert_utf8_to_utf16le(buf, len, utf16_output);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16be(
|
|
380
|
+
const char *buf, size_t len,
|
|
381
|
+
char16_t *utf16_output) const noexcept final override {
|
|
382
|
+
return set_best()->convert_utf8_to_utf16be(buf, len, utf16_output);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
simdutf_warn_unused result convert_utf8_to_utf16le_with_errors(
|
|
386
|
+
const char *buf, size_t len,
|
|
387
|
+
char16_t *utf16_output) const noexcept final override {
|
|
388
|
+
return set_best()->convert_utf8_to_utf16le_with_errors(buf, len,
|
|
389
|
+
utf16_output);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
simdutf_warn_unused result convert_utf8_to_utf16be_with_errors(
|
|
393
|
+
const char *buf, size_t len,
|
|
394
|
+
char16_t *utf16_output) const noexcept final override {
|
|
395
|
+
return set_best()->convert_utf8_to_utf16be_with_errors(buf, len,
|
|
396
|
+
utf16_output);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16le(
|
|
400
|
+
const char *buf, size_t len,
|
|
401
|
+
char16_t *utf16_output) const noexcept final override {
|
|
402
|
+
return set_best()->convert_valid_utf8_to_utf16le(buf, len, utf16_output);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16be(
|
|
406
|
+
const char *buf, size_t len,
|
|
407
|
+
char16_t *utf16_output) const noexcept final override {
|
|
408
|
+
return set_best()->convert_valid_utf8_to_utf16be(buf, len, utf16_output);
|
|
409
|
+
}
|
|
410
|
+
simdutf_warn_unused result utf8_length_from_utf16le_with_replacement(
|
|
411
|
+
const char16_t *input, size_t length) const noexcept final override {
|
|
412
|
+
return set_best()->utf8_length_from_utf16le_with_replacement(input, length);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
simdutf_warn_unused result utf8_length_from_utf16be_with_replacement(
|
|
416
|
+
const char16_t *input, size_t length) const noexcept final override {
|
|
417
|
+
return set_best()->utf8_length_from_utf16be_with_replacement(input, length);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf8_with_replacement(
|
|
421
|
+
const char16_t *input, size_t length,
|
|
422
|
+
char *utf8_buffer) const noexcept final override {
|
|
423
|
+
return set_best()->convert_utf16le_to_utf8_with_replacement(input, length,
|
|
424
|
+
utf8_buffer);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf8_with_replacement(
|
|
428
|
+
const char16_t *input, size_t length,
|
|
429
|
+
char *utf8_buffer) const noexcept final override {
|
|
430
|
+
return set_best()->convert_utf16be_to_utf8_with_replacement(input, length,
|
|
431
|
+
utf8_buffer);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
435
|
+
|
|
436
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
437
|
+
simdutf_warn_unused size_t
|
|
438
|
+
convert_utf8_to_utf32(const char *buf, size_t len,
|
|
439
|
+
char32_t *utf32_output) const noexcept final override {
|
|
440
|
+
return set_best()->convert_utf8_to_utf32(buf, len, utf32_output);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
simdutf_warn_unused result convert_utf8_to_utf32_with_errors(
|
|
444
|
+
const char *buf, size_t len,
|
|
445
|
+
char32_t *utf32_output) const noexcept final override {
|
|
446
|
+
return set_best()->convert_utf8_to_utf32_with_errors(buf, len,
|
|
447
|
+
utf32_output);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf32(
|
|
451
|
+
const char *buf, size_t len,
|
|
452
|
+
char32_t *utf32_output) const noexcept final override {
|
|
453
|
+
return set_best()->convert_valid_utf8_to_utf32(buf, len, utf32_output);
|
|
454
|
+
}
|
|
455
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
456
|
+
|
|
457
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
458
|
+
simdutf_warn_unused size_t
|
|
459
|
+
convert_utf16le_to_latin1(const char16_t *buf, size_t len,
|
|
460
|
+
char *latin1_output) const noexcept final override {
|
|
461
|
+
return set_best()->convert_utf16le_to_latin1(buf, len, latin1_output);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
simdutf_warn_unused size_t
|
|
465
|
+
convert_utf16be_to_latin1(const char16_t *buf, size_t len,
|
|
466
|
+
char *latin1_output) const noexcept final override {
|
|
467
|
+
return set_best()->convert_utf16be_to_latin1(buf, len, latin1_output);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
simdutf_warn_unused result convert_utf16le_to_latin1_with_errors(
|
|
471
|
+
const char16_t *buf, size_t len,
|
|
472
|
+
char *latin1_output) const noexcept final override {
|
|
473
|
+
return set_best()->convert_utf16le_to_latin1_with_errors(buf, len,
|
|
474
|
+
latin1_output);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
simdutf_warn_unused result convert_utf16be_to_latin1_with_errors(
|
|
478
|
+
const char16_t *buf, size_t len,
|
|
479
|
+
char *latin1_output) const noexcept final override {
|
|
480
|
+
return set_best()->convert_utf16be_to_latin1_with_errors(buf, len,
|
|
481
|
+
latin1_output);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_latin1(
|
|
485
|
+
const char16_t *buf, size_t len,
|
|
486
|
+
char *latin1_output) const noexcept final override {
|
|
487
|
+
return set_best()->convert_valid_utf16le_to_latin1(buf, len, latin1_output);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_latin1(
|
|
491
|
+
const char16_t *buf, size_t len,
|
|
492
|
+
char *latin1_output) const noexcept final override {
|
|
493
|
+
return set_best()->convert_valid_utf16be_to_latin1(buf, len, latin1_output);
|
|
494
|
+
}
|
|
495
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
496
|
+
|
|
497
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
498
|
+
simdutf_warn_unused size_t
|
|
499
|
+
convert_utf16le_to_utf8(const char16_t *buf, size_t len,
|
|
500
|
+
char *utf8_output) const noexcept final override {
|
|
501
|
+
return set_best()->convert_utf16le_to_utf8(buf, len, utf8_output);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
simdutf_warn_unused size_t
|
|
505
|
+
convert_utf16be_to_utf8(const char16_t *buf, size_t len,
|
|
506
|
+
char *utf8_output) const noexcept final override {
|
|
507
|
+
return set_best()->convert_utf16be_to_utf8(buf, len, utf8_output);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
simdutf_warn_unused result convert_utf16le_to_utf8_with_errors(
|
|
511
|
+
const char16_t *buf, size_t len,
|
|
512
|
+
char *utf8_output) const noexcept final override {
|
|
513
|
+
return set_best()->convert_utf16le_to_utf8_with_errors(buf, len,
|
|
514
|
+
utf8_output);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
simdutf_warn_unused result convert_utf16be_to_utf8_with_errors(
|
|
518
|
+
const char16_t *buf, size_t len,
|
|
519
|
+
char *utf8_output) const noexcept final override {
|
|
520
|
+
return set_best()->convert_utf16be_to_utf8_with_errors(buf, len,
|
|
521
|
+
utf8_output);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf8(
|
|
525
|
+
const char16_t *buf, size_t len,
|
|
526
|
+
char *utf8_output) const noexcept final override {
|
|
527
|
+
return set_best()->convert_valid_utf16le_to_utf8(buf, len, utf8_output);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf8(
|
|
531
|
+
const char16_t *buf, size_t len,
|
|
532
|
+
char *utf8_output) const noexcept final override {
|
|
533
|
+
return set_best()->convert_valid_utf16be_to_utf8(buf, len, utf8_output);
|
|
534
|
+
}
|
|
535
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
536
|
+
|
|
537
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
538
|
+
simdutf_warn_unused size_t
|
|
539
|
+
convert_utf32_to_latin1(const char32_t *buf, size_t len,
|
|
540
|
+
char *latin1_output) const noexcept final override {
|
|
541
|
+
return set_best()->convert_utf32_to_latin1(buf, len, latin1_output);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
simdutf_warn_unused result convert_utf32_to_latin1_with_errors(
|
|
545
|
+
const char32_t *buf, size_t len,
|
|
546
|
+
char *latin1_output) const noexcept final override {
|
|
547
|
+
return set_best()->convert_utf32_to_latin1_with_errors(buf, len,
|
|
548
|
+
latin1_output);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_latin1(
|
|
552
|
+
const char32_t *buf, size_t len,
|
|
553
|
+
char *latin1_output) const noexcept final override {
|
|
554
|
+
return set_best()->convert_utf32_to_latin1(buf, len, latin1_output);
|
|
555
|
+
}
|
|
556
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
557
|
+
|
|
558
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
559
|
+
simdutf_warn_unused size_t
|
|
560
|
+
convert_utf32_to_utf8(const char32_t *buf, size_t len,
|
|
561
|
+
char *utf8_output) const noexcept final override {
|
|
562
|
+
return set_best()->convert_utf32_to_utf8(buf, len, utf8_output);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
simdutf_warn_unused result convert_utf32_to_utf8_with_errors(
|
|
566
|
+
const char32_t *buf, size_t len,
|
|
567
|
+
char *utf8_output) const noexcept final override {
|
|
568
|
+
return set_best()->convert_utf32_to_utf8_with_errors(buf, len, utf8_output);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
simdutf_warn_unused size_t
|
|
572
|
+
convert_valid_utf32_to_utf8(const char32_t *buf, size_t len,
|
|
573
|
+
char *utf8_output) const noexcept final override {
|
|
574
|
+
return set_best()->convert_valid_utf32_to_utf8(buf, len, utf8_output);
|
|
575
|
+
}
|
|
576
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
577
|
+
|
|
578
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
579
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16le(
|
|
580
|
+
const char32_t *buf, size_t len,
|
|
581
|
+
char16_t *utf16_output) const noexcept final override {
|
|
582
|
+
return set_best()->convert_utf32_to_utf16le(buf, len, utf16_output);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16be(
|
|
586
|
+
const char32_t *buf, size_t len,
|
|
587
|
+
char16_t *utf16_output) const noexcept final override {
|
|
588
|
+
return set_best()->convert_utf32_to_utf16be(buf, len, utf16_output);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
simdutf_warn_unused result convert_utf32_to_utf16le_with_errors(
|
|
592
|
+
const char32_t *buf, size_t len,
|
|
593
|
+
char16_t *utf16_output) const noexcept final override {
|
|
594
|
+
return set_best()->convert_utf32_to_utf16le_with_errors(buf, len,
|
|
595
|
+
utf16_output);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
simdutf_warn_unused result convert_utf32_to_utf16be_with_errors(
|
|
599
|
+
const char32_t *buf, size_t len,
|
|
600
|
+
char16_t *utf16_output) const noexcept final override {
|
|
601
|
+
return set_best()->convert_utf32_to_utf16be_with_errors(buf, len,
|
|
602
|
+
utf16_output);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16le(
|
|
606
|
+
const char32_t *buf, size_t len,
|
|
607
|
+
char16_t *utf16_output) const noexcept final override {
|
|
608
|
+
return set_best()->convert_valid_utf32_to_utf16le(buf, len, utf16_output);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16be(
|
|
612
|
+
const char32_t *buf, size_t len,
|
|
613
|
+
char16_t *utf16_output) const noexcept final override {
|
|
614
|
+
return set_best()->convert_valid_utf32_to_utf16be(buf, len, utf16_output);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf32(
|
|
618
|
+
const char16_t *buf, size_t len,
|
|
619
|
+
char32_t *utf32_output) const noexcept final override {
|
|
620
|
+
return set_best()->convert_utf16le_to_utf32(buf, len, utf32_output);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf32(
|
|
624
|
+
const char16_t *buf, size_t len,
|
|
625
|
+
char32_t *utf32_output) const noexcept final override {
|
|
626
|
+
return set_best()->convert_utf16be_to_utf32(buf, len, utf32_output);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
simdutf_warn_unused result convert_utf16le_to_utf32_with_errors(
|
|
630
|
+
const char16_t *buf, size_t len,
|
|
631
|
+
char32_t *utf32_output) const noexcept final override {
|
|
632
|
+
return set_best()->convert_utf16le_to_utf32_with_errors(buf, len,
|
|
633
|
+
utf32_output);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
simdutf_warn_unused result convert_utf16be_to_utf32_with_errors(
|
|
637
|
+
const char16_t *buf, size_t len,
|
|
638
|
+
char32_t *utf32_output) const noexcept final override {
|
|
639
|
+
return set_best()->convert_utf16be_to_utf32_with_errors(buf, len,
|
|
640
|
+
utf32_output);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf32(
|
|
644
|
+
const char16_t *buf, size_t len,
|
|
645
|
+
char32_t *utf32_output) const noexcept final override {
|
|
646
|
+
return set_best()->convert_valid_utf16le_to_utf32(buf, len, utf32_output);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf32(
|
|
650
|
+
const char16_t *buf, size_t len,
|
|
651
|
+
char32_t *utf32_output) const noexcept final override {
|
|
652
|
+
return set_best()->convert_valid_utf16be_to_utf32(buf, len, utf32_output);
|
|
653
|
+
}
|
|
654
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
655
|
+
|
|
656
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
657
|
+
void change_endianness_utf16(const char16_t *buf, size_t len,
|
|
658
|
+
char16_t *output) const noexcept final override {
|
|
659
|
+
set_best()->change_endianness_utf16(buf, len, output);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
simdutf_warn_unused size_t
|
|
663
|
+
count_utf16le(const char16_t *buf, size_t len) const noexcept final override {
|
|
664
|
+
return set_best()->count_utf16le(buf, len);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
simdutf_warn_unused size_t
|
|
668
|
+
count_utf16be(const char16_t *buf, size_t len) const noexcept final override {
|
|
669
|
+
return set_best()->count_utf16be(buf, len);
|
|
670
|
+
}
|
|
671
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
672
|
+
|
|
673
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
674
|
+
simdutf_warn_unused size_t
|
|
675
|
+
count_utf8(const char *buf, size_t len) const noexcept final override {
|
|
676
|
+
return set_best()->count_utf8(buf, len);
|
|
677
|
+
}
|
|
678
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
679
|
+
|
|
680
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
681
|
+
simdutf_warn_unused size_t
|
|
682
|
+
latin1_length_from_utf8(const char *buf, size_t len) const noexcept override {
|
|
683
|
+
return set_best()->latin1_length_from_utf8(buf, len);
|
|
684
|
+
}
|
|
685
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
686
|
+
|
|
687
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
688
|
+
simdutf_warn_unused size_t
|
|
689
|
+
utf8_length_from_latin1(const char *buf, size_t len) const noexcept override {
|
|
690
|
+
return set_best()->utf8_length_from_latin1(buf, len);
|
|
691
|
+
}
|
|
692
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
693
|
+
|
|
694
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
695
|
+
simdutf_warn_unused size_t utf8_length_from_utf16le(
|
|
696
|
+
const char16_t *buf, size_t len) const noexcept override {
|
|
697
|
+
return set_best()->utf8_length_from_utf16le(buf, len);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
simdutf_warn_unused size_t utf8_length_from_utf16be(
|
|
701
|
+
const char16_t *buf, size_t len) const noexcept override {
|
|
702
|
+
return set_best()->utf8_length_from_utf16be(buf, len);
|
|
703
|
+
}
|
|
704
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
705
|
+
|
|
706
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
707
|
+
simdutf_warn_unused size_t utf32_length_from_utf16le(
|
|
708
|
+
const char16_t *buf, size_t len) const noexcept override {
|
|
709
|
+
return set_best()->utf32_length_from_utf16le(buf, len);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
simdutf_warn_unused size_t utf32_length_from_utf16be(
|
|
713
|
+
const char16_t *buf, size_t len) const noexcept override {
|
|
714
|
+
return set_best()->utf32_length_from_utf16be(buf, len);
|
|
715
|
+
}
|
|
716
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
717
|
+
|
|
718
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
719
|
+
simdutf_warn_unused size_t
|
|
720
|
+
utf16_length_from_utf8(const char *buf, size_t len) const noexcept override {
|
|
721
|
+
return set_best()->utf16_length_from_utf8(buf, len);
|
|
722
|
+
}
|
|
723
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
724
|
+
|
|
725
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
726
|
+
simdutf_warn_unused size_t utf8_length_from_utf32(
|
|
727
|
+
const char32_t *buf, size_t len) const noexcept override {
|
|
728
|
+
return set_best()->utf8_length_from_utf32(buf, len);
|
|
729
|
+
}
|
|
730
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
731
|
+
|
|
732
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
733
|
+
simdutf_warn_unused size_t utf16_length_from_utf32(
|
|
734
|
+
const char32_t *buf, size_t len) const noexcept override {
|
|
735
|
+
return set_best()->utf16_length_from_utf32(buf, len);
|
|
736
|
+
}
|
|
737
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
738
|
+
|
|
739
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
740
|
+
simdutf_warn_unused size_t
|
|
741
|
+
utf32_length_from_utf8(const char *buf, size_t len) const noexcept override {
|
|
742
|
+
return set_best()->utf32_length_from_utf8(buf, len);
|
|
743
|
+
}
|
|
744
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
745
|
+
|
|
746
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
747
|
+
simdutf_warn_unused result base64_to_binary(
|
|
748
|
+
const char *input, size_t length, char *output, base64_options options,
|
|
749
|
+
last_chunk_handling_options last_chunk_handling_options =
|
|
750
|
+
last_chunk_handling_options::loose) const noexcept override {
|
|
751
|
+
return set_best()->base64_to_binary(input, length, output, options,
|
|
752
|
+
last_chunk_handling_options);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
simdutf_warn_unused full_result base64_to_binary_details(
|
|
756
|
+
const char *input, size_t length, char *output, base64_options options,
|
|
757
|
+
last_chunk_handling_options last_chunk_handling_options =
|
|
758
|
+
last_chunk_handling_options::loose) const noexcept override {
|
|
759
|
+
return set_best()->base64_to_binary_details(input, length, output, options,
|
|
760
|
+
last_chunk_handling_options);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
simdutf_warn_unused result base64_to_binary(
|
|
764
|
+
const char16_t *input, size_t length, char *output,
|
|
765
|
+
base64_options options,
|
|
766
|
+
last_chunk_handling_options last_chunk_handling_options =
|
|
767
|
+
last_chunk_handling_options::loose) const noexcept override {
|
|
768
|
+
return set_best()->base64_to_binary(input, length, output, options,
|
|
769
|
+
last_chunk_handling_options);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
simdutf_warn_unused full_result base64_to_binary_details(
|
|
773
|
+
const char16_t *input, size_t length, char *output,
|
|
774
|
+
base64_options options,
|
|
775
|
+
last_chunk_handling_options last_chunk_handling_options =
|
|
776
|
+
last_chunk_handling_options::loose) const noexcept override {
|
|
777
|
+
return set_best()->base64_to_binary_details(input, length, output, options,
|
|
778
|
+
last_chunk_handling_options);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
size_t binary_to_base64(const char *input, size_t length, char *output,
|
|
782
|
+
base64_options options) const noexcept override {
|
|
783
|
+
return set_best()->binary_to_base64(input, length, output, options);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
size_t
|
|
787
|
+
binary_to_base64_with_lines(const char *input, size_t length, char *output,
|
|
788
|
+
size_t line_length,
|
|
789
|
+
base64_options options) const noexcept override {
|
|
790
|
+
return set_best()->binary_to_base64_with_lines(input, length, output,
|
|
791
|
+
line_length, options);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
const char *find(const char *start, const char *end,
|
|
795
|
+
char character) const noexcept override {
|
|
796
|
+
return set_best()->find(start, end, character);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const char16_t *find(const char16_t *start, const char16_t *end,
|
|
800
|
+
char16_t character) const noexcept override {
|
|
801
|
+
return set_best()->find(start, end, character);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
simdutf_warn_unused size_t binary_length_from_base64(
|
|
805
|
+
const char *input, size_t length) const noexcept override {
|
|
806
|
+
return set_best()->binary_length_from_base64(input, length);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
simdutf_warn_unused size_t binary_length_from_base64(
|
|
810
|
+
const char16_t *input, size_t length) const noexcept override {
|
|
811
|
+
return set_best()->binary_length_from_base64(input, length);
|
|
812
|
+
}
|
|
813
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
814
|
+
|
|
815
|
+
simdutf_really_inline
|
|
816
|
+
detect_best_supported_implementation_on_first_use() noexcept
|
|
817
|
+
: implementation("best_supported_detector",
|
|
818
|
+
"Detects the best supported implementation and sets it",
|
|
819
|
+
0) {}
|
|
820
|
+
|
|
821
|
+
private:
|
|
822
|
+
const implementation *set_best() const noexcept;
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
static_assert(std::is_trivially_destructible<
|
|
826
|
+
detect_best_supported_implementation_on_first_use>::value,
|
|
827
|
+
"detect_best_supported_implementation_on_first_use should be "
|
|
828
|
+
"trivially destructible");
|
|
829
|
+
|
|
830
|
+
static const std::initializer_list<const implementation *> &
|
|
831
|
+
get_available_implementation_pointers() {
|
|
832
|
+
static const std::initializer_list<const implementation *>
|
|
833
|
+
available_implementation_pointers{
|
|
834
|
+
#if SIMDUTF_IMPLEMENTATION_ICELAKE
|
|
835
|
+
get_icelake_singleton(),
|
|
836
|
+
#endif
|
|
837
|
+
#if SIMDUTF_IMPLEMENTATION_HASWELL
|
|
838
|
+
get_haswell_singleton(),
|
|
839
|
+
#endif
|
|
840
|
+
#if SIMDUTF_IMPLEMENTATION_WESTMERE
|
|
841
|
+
get_westmere_singleton(),
|
|
842
|
+
#endif
|
|
843
|
+
#if SIMDUTF_IMPLEMENTATION_ARM64
|
|
844
|
+
get_arm64_singleton(),
|
|
845
|
+
#endif
|
|
846
|
+
#if SIMDUTF_IMPLEMENTATION_PPC64
|
|
847
|
+
get_ppc64_singleton(),
|
|
848
|
+
#endif
|
|
849
|
+
#if SIMDUTF_IMPLEMENTATION_RVV
|
|
850
|
+
get_rvv_singleton(),
|
|
851
|
+
#endif
|
|
852
|
+
#if SIMDUTF_IMPLEMENTATION_LASX
|
|
853
|
+
get_lasx_singleton(),
|
|
854
|
+
#endif
|
|
855
|
+
#if SIMDUTF_IMPLEMENTATION_LSX
|
|
856
|
+
get_lsx_singleton(),
|
|
857
|
+
#endif
|
|
858
|
+
#if SIMDUTF_IMPLEMENTATION_FALLBACK
|
|
859
|
+
get_fallback_singleton(),
|
|
860
|
+
#endif
|
|
861
|
+
}; // available_implementation_pointers
|
|
862
|
+
return available_implementation_pointers;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// So we can return UNSUPPORTED_ARCHITECTURE from the parser when there is no
|
|
866
|
+
// support
|
|
867
|
+
class unsupported_implementation final : public implementation {
|
|
868
|
+
public:
|
|
869
|
+
#if SIMDUTF_FEATURE_DETECT_ENCODING
|
|
870
|
+
simdutf_warn_unused int detect_encodings(const char *,
|
|
871
|
+
size_t) const noexcept override {
|
|
872
|
+
return encoding_type::unspecified;
|
|
873
|
+
}
|
|
874
|
+
#endif // SIMDUTF_FEATURE_DETECT_ENCODING
|
|
875
|
+
|
|
876
|
+
#if SIMDUTF_FEATURE_UTF8 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
877
|
+
simdutf_warn_unused bool validate_utf8(const char *,
|
|
878
|
+
size_t) const noexcept final override {
|
|
879
|
+
return false; // Just refuse to validate. Given that we have a fallback
|
|
880
|
+
// implementation
|
|
881
|
+
// it seems unlikely that unsupported_implementation will ever be used. If
|
|
882
|
+
// it is used, then it will flag all strings as invalid. The alternative is
|
|
883
|
+
// to return an error_code from which the user has to figure out whether the
|
|
884
|
+
// string is valid UTF-8... which seems like a lot of work just to handle
|
|
885
|
+
// the very unlikely case that we have an unsupported implementation. And,
|
|
886
|
+
// when it does happen (that we have an unsupported implementation), what
|
|
887
|
+
// are the chances that the programmer has a fallback? Given that *we*
|
|
888
|
+
// provide the fallback, it implies that the programmer would need a
|
|
889
|
+
// fallback for our fallback.
|
|
890
|
+
}
|
|
891
|
+
#endif // SIMDUTF_FEATURE_UTF8 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
892
|
+
|
|
893
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
894
|
+
simdutf_warn_unused result validate_utf8_with_errors(
|
|
895
|
+
const char *, size_t) const noexcept final override {
|
|
896
|
+
return result(error_code::OTHER, 0);
|
|
897
|
+
}
|
|
898
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
899
|
+
|
|
900
|
+
#if SIMDUTF_FEATURE_ASCII
|
|
901
|
+
simdutf_warn_unused bool
|
|
902
|
+
validate_ascii(const char *, size_t) const noexcept final override {
|
|
903
|
+
return false;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
simdutf_warn_unused result validate_ascii_with_errors(
|
|
907
|
+
const char *, size_t) const noexcept final override {
|
|
908
|
+
return result(error_code::OTHER, 0);
|
|
909
|
+
}
|
|
910
|
+
#endif // SIMDUTF_FEATURE_ASCII
|
|
911
|
+
|
|
912
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
913
|
+
simdutf_warn_unused bool
|
|
914
|
+
validate_utf16le_as_ascii(const char16_t *,
|
|
915
|
+
size_t) const noexcept final override {
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
simdutf_warn_unused bool
|
|
920
|
+
validate_utf16be_as_ascii(const char16_t *,
|
|
921
|
+
size_t) const noexcept final override {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
925
|
+
|
|
926
|
+
#if SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
927
|
+
simdutf_warn_unused bool
|
|
928
|
+
validate_utf16le(const char16_t *, size_t) const noexcept final override {
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
#endif // SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
932
|
+
|
|
933
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
934
|
+
simdutf_warn_unused bool
|
|
935
|
+
validate_utf16be(const char16_t *, size_t) const noexcept final override {
|
|
936
|
+
return false;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
simdutf_warn_unused result validate_utf16le_with_errors(
|
|
940
|
+
const char16_t *, size_t) const noexcept final override {
|
|
941
|
+
return result(error_code::OTHER, 0);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
simdutf_warn_unused result validate_utf16be_with_errors(
|
|
945
|
+
const char16_t *, size_t) const noexcept final override {
|
|
946
|
+
return result(error_code::OTHER, 0);
|
|
947
|
+
}
|
|
948
|
+
void to_well_formed_utf16be(const char16_t *, size_t,
|
|
949
|
+
char16_t *) const noexcept final override {}
|
|
950
|
+
void to_well_formed_utf16le(const char16_t *, size_t,
|
|
951
|
+
char16_t *) const noexcept final override {}
|
|
952
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
953
|
+
|
|
954
|
+
#if SIMDUTF_FEATURE_UTF32 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
955
|
+
simdutf_warn_unused bool
|
|
956
|
+
validate_utf32(const char32_t *, size_t) const noexcept final override {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
#endif // SIMDUTF_FEATURE_UTF32 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
960
|
+
|
|
961
|
+
#if SIMDUTF_FEATURE_UTF32
|
|
962
|
+
simdutf_warn_unused result validate_utf32_with_errors(
|
|
963
|
+
const char32_t *, size_t) const noexcept final override {
|
|
964
|
+
return result(error_code::OTHER, 0);
|
|
965
|
+
}
|
|
966
|
+
#endif // SIMDUTF_FEATURE_UTF32
|
|
967
|
+
|
|
968
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
969
|
+
simdutf_warn_unused size_t convert_latin1_to_utf8(
|
|
970
|
+
const char *, size_t, char *) const noexcept final override {
|
|
971
|
+
return 0;
|
|
972
|
+
}
|
|
973
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
974
|
+
|
|
975
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
976
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16le(
|
|
977
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
978
|
+
return 0;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16be(
|
|
982
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
983
|
+
return 0;
|
|
984
|
+
}
|
|
985
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
986
|
+
|
|
987
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
988
|
+
simdutf_warn_unused size_t convert_latin1_to_utf32(
|
|
989
|
+
const char *, size_t, char32_t *) const noexcept final override {
|
|
990
|
+
return 0;
|
|
991
|
+
}
|
|
992
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
993
|
+
|
|
994
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
995
|
+
simdutf_warn_unused size_t convert_utf8_to_latin1(
|
|
996
|
+
const char *, size_t, char *) const noexcept final override {
|
|
997
|
+
return 0;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
simdutf_warn_unused result convert_utf8_to_latin1_with_errors(
|
|
1001
|
+
const char *, size_t, char *) const noexcept final override {
|
|
1002
|
+
return result(error_code::OTHER, 0);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_latin1(
|
|
1006
|
+
const char *, size_t, char *) const noexcept final override {
|
|
1007
|
+
return 0;
|
|
1008
|
+
}
|
|
1009
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1010
|
+
|
|
1011
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1012
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16le(
|
|
1013
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1014
|
+
return 0;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16be(
|
|
1018
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1019
|
+
return 0;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
simdutf_warn_unused result convert_utf8_to_utf16le_with_errors(
|
|
1023
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1024
|
+
return result(error_code::OTHER, 0);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
simdutf_warn_unused result convert_utf8_to_utf16be_with_errors(
|
|
1028
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1029
|
+
return result(error_code::OTHER, 0);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16le(
|
|
1033
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1034
|
+
return 0;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16be(
|
|
1038
|
+
const char *, size_t, char16_t *) const noexcept final override {
|
|
1039
|
+
return 0;
|
|
1040
|
+
}
|
|
1041
|
+
simdutf_warn_unused result utf8_length_from_utf16le_with_replacement(
|
|
1042
|
+
const char16_t *, size_t) const noexcept final override {
|
|
1043
|
+
return {OTHER, 0}; // Not supported
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
simdutf_warn_unused result utf8_length_from_utf16be_with_replacement(
|
|
1047
|
+
const char16_t *, size_t) const noexcept final override {
|
|
1048
|
+
return {OTHER, 0}; // Not supported
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf8_with_replacement(
|
|
1052
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1053
|
+
return 0; // Not supported
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf8_with_replacement(
|
|
1057
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1058
|
+
return 0; // Not supported
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1062
|
+
|
|
1063
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1064
|
+
simdutf_warn_unused size_t convert_utf8_to_utf32(
|
|
1065
|
+
const char *, size_t, char32_t *) const noexcept final override {
|
|
1066
|
+
return 0;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
simdutf_warn_unused result convert_utf8_to_utf32_with_errors(
|
|
1070
|
+
const char *, size_t, char32_t *) const noexcept final override {
|
|
1071
|
+
return result(error_code::OTHER, 0);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf32(
|
|
1075
|
+
const char *, size_t, char32_t *) const noexcept final override {
|
|
1076
|
+
return 0;
|
|
1077
|
+
}
|
|
1078
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1079
|
+
|
|
1080
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1081
|
+
simdutf_warn_unused size_t convert_utf16le_to_latin1(
|
|
1082
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1083
|
+
return 0;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
simdutf_warn_unused size_t convert_utf16be_to_latin1(
|
|
1087
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1088
|
+
return 0;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
simdutf_warn_unused result convert_utf16le_to_latin1_with_errors(
|
|
1092
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1093
|
+
return result(error_code::OTHER, 0);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
simdutf_warn_unused result convert_utf16be_to_latin1_with_errors(
|
|
1097
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1098
|
+
return result(error_code::OTHER, 0);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_latin1(
|
|
1102
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1103
|
+
return 0;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_latin1(
|
|
1107
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1108
|
+
return 0;
|
|
1109
|
+
}
|
|
1110
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1111
|
+
|
|
1112
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1113
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf8(
|
|
1114
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1115
|
+
return 0;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf8(
|
|
1119
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1120
|
+
return 0;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
simdutf_warn_unused result convert_utf16le_to_utf8_with_errors(
|
|
1124
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1125
|
+
return result(error_code::OTHER, 0);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
simdutf_warn_unused result convert_utf16be_to_utf8_with_errors(
|
|
1129
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1130
|
+
return result(error_code::OTHER, 0);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf8(
|
|
1134
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1135
|
+
return 0;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf8(
|
|
1139
|
+
const char16_t *, size_t, char *) const noexcept final override {
|
|
1140
|
+
return 0;
|
|
1141
|
+
}
|
|
1142
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1143
|
+
|
|
1144
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
1145
|
+
simdutf_warn_unused size_t convert_utf32_to_latin1(
|
|
1146
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1147
|
+
return 0;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
simdutf_warn_unused result convert_utf32_to_latin1_with_errors(
|
|
1151
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1152
|
+
return result(error_code::OTHER, 0);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_latin1(
|
|
1156
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1157
|
+
return 0;
|
|
1158
|
+
}
|
|
1159
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
1160
|
+
|
|
1161
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1162
|
+
simdutf_warn_unused size_t convert_utf32_to_utf8(
|
|
1163
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1164
|
+
return 0;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
simdutf_warn_unused result convert_utf32_to_utf8_with_errors(
|
|
1168
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1169
|
+
return result(error_code::OTHER, 0);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf8(
|
|
1173
|
+
const char32_t *, size_t, char *) const noexcept final override {
|
|
1174
|
+
return 0;
|
|
1175
|
+
}
|
|
1176
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1177
|
+
|
|
1178
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1179
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16le(
|
|
1180
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1181
|
+
return 0;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16be(
|
|
1185
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1186
|
+
return 0;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
simdutf_warn_unused result convert_utf32_to_utf16le_with_errors(
|
|
1190
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1191
|
+
return result(error_code::OTHER, 0);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
simdutf_warn_unused result convert_utf32_to_utf16be_with_errors(
|
|
1195
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1196
|
+
return result(error_code::OTHER, 0);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16le(
|
|
1200
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1201
|
+
return 0;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16be(
|
|
1205
|
+
const char32_t *, size_t, char16_t *) const noexcept final override {
|
|
1206
|
+
return 0;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf32(
|
|
1210
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1211
|
+
return 0;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf32(
|
|
1215
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1216
|
+
return 0;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
simdutf_warn_unused result convert_utf16le_to_utf32_with_errors(
|
|
1220
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1221
|
+
return result(error_code::OTHER, 0);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
simdutf_warn_unused result convert_utf16be_to_utf32_with_errors(
|
|
1225
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1226
|
+
return result(error_code::OTHER, 0);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf32(
|
|
1230
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1231
|
+
return 0;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf32(
|
|
1235
|
+
const char16_t *, size_t, char32_t *) const noexcept final override {
|
|
1236
|
+
return 0;
|
|
1237
|
+
}
|
|
1238
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1239
|
+
|
|
1240
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
1241
|
+
void change_endianness_utf16(const char16_t *, size_t,
|
|
1242
|
+
char16_t *) const noexcept final override {}
|
|
1243
|
+
|
|
1244
|
+
simdutf_warn_unused size_t
|
|
1245
|
+
count_utf16le(const char16_t *, size_t) const noexcept final override {
|
|
1246
|
+
return 0;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
simdutf_warn_unused size_t
|
|
1250
|
+
count_utf16be(const char16_t *, size_t) const noexcept final override {
|
|
1251
|
+
return 0;
|
|
1252
|
+
}
|
|
1253
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
1254
|
+
|
|
1255
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
1256
|
+
simdutf_warn_unused size_t count_utf8(const char *,
|
|
1257
|
+
size_t) const noexcept final override {
|
|
1258
|
+
return 0;
|
|
1259
|
+
}
|
|
1260
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
1261
|
+
|
|
1262
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1263
|
+
simdutf_warn_unused size_t
|
|
1264
|
+
latin1_length_from_utf8(const char *, size_t) const noexcept override {
|
|
1265
|
+
return 0;
|
|
1266
|
+
}
|
|
1267
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1268
|
+
|
|
1269
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1270
|
+
simdutf_warn_unused size_t
|
|
1271
|
+
utf8_length_from_latin1(const char *, size_t) const noexcept override {
|
|
1272
|
+
return 0;
|
|
1273
|
+
}
|
|
1274
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1275
|
+
|
|
1276
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1277
|
+
simdutf_warn_unused size_t
|
|
1278
|
+
utf8_length_from_utf16le(const char16_t *, size_t) const noexcept override {
|
|
1279
|
+
return 0;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
simdutf_warn_unused size_t
|
|
1283
|
+
utf8_length_from_utf16be(const char16_t *, size_t) const noexcept override {
|
|
1284
|
+
return 0;
|
|
1285
|
+
}
|
|
1286
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1287
|
+
|
|
1288
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1289
|
+
simdutf_warn_unused size_t
|
|
1290
|
+
utf32_length_from_utf16le(const char16_t *, size_t) const noexcept override {
|
|
1291
|
+
return 0;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
simdutf_warn_unused size_t
|
|
1295
|
+
utf32_length_from_utf16be(const char16_t *, size_t) const noexcept override {
|
|
1296
|
+
return 0;
|
|
1297
|
+
}
|
|
1298
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1299
|
+
|
|
1300
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1301
|
+
simdutf_warn_unused size_t
|
|
1302
|
+
utf16_length_from_utf8(const char *, size_t) const noexcept override {
|
|
1303
|
+
return 0;
|
|
1304
|
+
}
|
|
1305
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1306
|
+
|
|
1307
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1308
|
+
simdutf_warn_unused size_t
|
|
1309
|
+
utf8_length_from_utf32(const char32_t *, size_t) const noexcept override {
|
|
1310
|
+
return 0;
|
|
1311
|
+
}
|
|
1312
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1313
|
+
|
|
1314
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1315
|
+
simdutf_warn_unused size_t
|
|
1316
|
+
utf16_length_from_utf32(const char32_t *, size_t) const noexcept override {
|
|
1317
|
+
return 0;
|
|
1318
|
+
}
|
|
1319
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
1320
|
+
|
|
1321
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1322
|
+
simdutf_warn_unused size_t
|
|
1323
|
+
utf32_length_from_utf8(const char *, size_t) const noexcept override {
|
|
1324
|
+
return 0;
|
|
1325
|
+
}
|
|
1326
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1327
|
+
|
|
1328
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
1329
|
+
simdutf_warn_unused result
|
|
1330
|
+
base64_to_binary(const char *, size_t, char *, base64_options,
|
|
1331
|
+
last_chunk_handling_options) const noexcept override {
|
|
1332
|
+
return result(error_code::OTHER, 0);
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
simdutf_warn_unused full_result base64_to_binary_details(
|
|
1336
|
+
const char *, size_t, char *, base64_options,
|
|
1337
|
+
last_chunk_handling_options) const noexcept override {
|
|
1338
|
+
return full_result(error_code::OTHER, 0, 0);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
simdutf_warn_unused result
|
|
1342
|
+
base64_to_binary(const char16_t *, size_t, char *, base64_options,
|
|
1343
|
+
last_chunk_handling_options) const noexcept override {
|
|
1344
|
+
return result(error_code::OTHER, 0);
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
simdutf_warn_unused full_result base64_to_binary_details(
|
|
1348
|
+
const char16_t *, size_t, char *, base64_options,
|
|
1349
|
+
last_chunk_handling_options) const noexcept override {
|
|
1350
|
+
return full_result(error_code::OTHER, 0, 0);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
size_t binary_to_base64(const char *, size_t, char *,
|
|
1354
|
+
base64_options) const noexcept override {
|
|
1355
|
+
return 0;
|
|
1356
|
+
}
|
|
1357
|
+
size_t binary_to_base64_with_lines(const char *, size_t, char *, size_t,
|
|
1358
|
+
base64_options) const noexcept override {
|
|
1359
|
+
return 0;
|
|
1360
|
+
}
|
|
1361
|
+
const char *find(const char *, const char *, char) const noexcept override {
|
|
1362
|
+
return nullptr;
|
|
1363
|
+
}
|
|
1364
|
+
const char16_t *find(const char16_t *, const char16_t *,
|
|
1365
|
+
char16_t) const noexcept override {
|
|
1366
|
+
return nullptr;
|
|
1367
|
+
}
|
|
1368
|
+
simdutf_warn_unused size_t
|
|
1369
|
+
binary_length_from_base64(const char *, size_t) const noexcept override {
|
|
1370
|
+
return 0;
|
|
1371
|
+
}
|
|
1372
|
+
simdutf_warn_unused size_t
|
|
1373
|
+
binary_length_from_base64(const char16_t *, size_t) const noexcept override {
|
|
1374
|
+
return 0;
|
|
1375
|
+
}
|
|
1376
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
1377
|
+
|
|
1378
|
+
unsupported_implementation()
|
|
1379
|
+
: implementation("unsupported",
|
|
1380
|
+
"Unsupported CPU (no detected SIMD instructions)", 0) {}
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
const unsupported_implementation *get_unsupported_singleton() {
|
|
1384
|
+
static const unsupported_implementation unsupported_singleton{};
|
|
1385
|
+
return &unsupported_singleton;
|
|
1386
|
+
}
|
|
1387
|
+
static_assert(std::is_trivially_destructible<unsupported_implementation>::value,
|
|
1388
|
+
"unsupported_singleton should be trivially destructible");
|
|
1389
|
+
|
|
1390
|
+
size_t available_implementation_list::size() const noexcept {
|
|
1391
|
+
return internal::get_available_implementation_pointers().size();
|
|
1392
|
+
}
|
|
1393
|
+
const implementation *const *
|
|
1394
|
+
available_implementation_list::begin() const noexcept {
|
|
1395
|
+
return internal::get_available_implementation_pointers().begin();
|
|
1396
|
+
}
|
|
1397
|
+
const implementation *const *
|
|
1398
|
+
available_implementation_list::end() const noexcept {
|
|
1399
|
+
return internal::get_available_implementation_pointers().end();
|
|
1400
|
+
}
|
|
1401
|
+
const implementation *
|
|
1402
|
+
available_implementation_list::detect_best_supported() const noexcept {
|
|
1403
|
+
// They are prelisted in priority order, so we just go down the list
|
|
1404
|
+
uint32_t supported_instruction_sets =
|
|
1405
|
+
internal::detect_supported_architectures();
|
|
1406
|
+
for (const implementation *impl :
|
|
1407
|
+
internal::get_available_implementation_pointers()) {
|
|
1408
|
+
uint32_t required_instruction_sets = impl->required_instruction_sets();
|
|
1409
|
+
if ((supported_instruction_sets & required_instruction_sets) ==
|
|
1410
|
+
required_instruction_sets) {
|
|
1411
|
+
return impl;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return get_unsupported_singleton(); // this should never happen?
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
const implementation *
|
|
1418
|
+
detect_best_supported_implementation_on_first_use::set_best() const noexcept {
|
|
1419
|
+
SIMDUTF_PUSH_DISABLE_WARNINGS
|
|
1420
|
+
SIMDUTF_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC:
|
|
1421
|
+
// manually verified this is safe
|
|
1422
|
+
char *force_implementation_name = getenv("SIMDUTF_FORCE_IMPLEMENTATION");
|
|
1423
|
+
SIMDUTF_POP_DISABLE_WARNINGS
|
|
1424
|
+
|
|
1425
|
+
if (force_implementation_name) {
|
|
1426
|
+
auto force_implementation =
|
|
1427
|
+
get_available_implementations()[force_implementation_name];
|
|
1428
|
+
if (force_implementation) {
|
|
1429
|
+
return get_active_implementation() = force_implementation;
|
|
1430
|
+
} else {
|
|
1431
|
+
// Note: abort() and stderr usage within the library is forbidden.
|
|
1432
|
+
return get_active_implementation() = get_unsupported_singleton();
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
return get_active_implementation() =
|
|
1436
|
+
get_available_implementations().detect_best_supported();
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
} // namespace internal
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* The list of available implementations compiled into simdutf.
|
|
1443
|
+
*/
|
|
1444
|
+
SIMDUTF_DLLIMPORTEXPORT const internal::available_implementation_list &
|
|
1445
|
+
get_available_implementations() {
|
|
1446
|
+
static const internal::available_implementation_list
|
|
1447
|
+
available_implementations{};
|
|
1448
|
+
return available_implementations;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* The active implementation.
|
|
1453
|
+
*/
|
|
1454
|
+
SIMDUTF_DLLIMPORTEXPORT internal::atomic_ptr<const implementation> &
|
|
1455
|
+
get_active_implementation() {
|
|
1456
|
+
#if SIMDUTF_SINGLE_IMPLEMENTATION
|
|
1457
|
+
// skip runtime detection
|
|
1458
|
+
static internal::atomic_ptr<const implementation> active_implementation{
|
|
1459
|
+
internal::get_single_implementation()};
|
|
1460
|
+
return active_implementation;
|
|
1461
|
+
#else
|
|
1462
|
+
static const internal::detect_best_supported_implementation_on_first_use
|
|
1463
|
+
detect_best_supported_implementation_on_first_use_singleton;
|
|
1464
|
+
static internal::atomic_ptr<const implementation> active_implementation{
|
|
1465
|
+
&detect_best_supported_implementation_on_first_use_singleton};
|
|
1466
|
+
return active_implementation;
|
|
1467
|
+
#endif
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
#if SIMDUTF_SINGLE_IMPLEMENTATION
|
|
1471
|
+
simdutf_really_inline const implementation *get_default_implementation() {
|
|
1472
|
+
return internal::get_single_implementation();
|
|
1473
|
+
}
|
|
1474
|
+
#else
|
|
1475
|
+
simdutf_really_inline internal::atomic_ptr<const implementation> &
|
|
1476
|
+
get_default_implementation() {
|
|
1477
|
+
return get_active_implementation();
|
|
1478
|
+
}
|
|
1479
|
+
#endif
|
|
1480
|
+
#define SIMDUTF_GET_CURRENT_IMPLEMENTATION
|
|
1481
|
+
|
|
1482
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
1483
|
+
simdutf_warn_unused bool validate_utf8(const char *buf, size_t len) noexcept {
|
|
1484
|
+
return get_default_implementation()->validate_utf8(buf, len);
|
|
1485
|
+
}
|
|
1486
|
+
simdutf_warn_unused result validate_utf8_with_errors(const char *buf,
|
|
1487
|
+
size_t len) noexcept {
|
|
1488
|
+
return get_default_implementation()->validate_utf8_with_errors(buf, len);
|
|
1489
|
+
}
|
|
1490
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
1491
|
+
|
|
1492
|
+
#if SIMDUTF_FEATURE_ASCII
|
|
1493
|
+
simdutf_warn_unused bool validate_ascii(const char *buf, size_t len) noexcept {
|
|
1494
|
+
return get_default_implementation()->validate_ascii(buf, len);
|
|
1495
|
+
}
|
|
1496
|
+
simdutf_warn_unused result validate_ascii_with_errors(const char *buf,
|
|
1497
|
+
size_t len) noexcept {
|
|
1498
|
+
return get_default_implementation()->validate_ascii_with_errors(buf, len);
|
|
1499
|
+
}
|
|
1500
|
+
#endif // SIMDUTF_FEATURE_ASCII
|
|
1501
|
+
|
|
1502
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
1503
|
+
simdutf_warn_unused bool validate_utf16le_as_ascii(const char16_t *buf,
|
|
1504
|
+
size_t len) noexcept {
|
|
1505
|
+
return get_default_implementation()->validate_utf16le_as_ascii(buf, len);
|
|
1506
|
+
}
|
|
1507
|
+
simdutf_warn_unused bool validate_utf16be_as_ascii(const char16_t *buf,
|
|
1508
|
+
size_t len) noexcept {
|
|
1509
|
+
return get_default_implementation()->validate_utf16be_as_ascii(buf, len);
|
|
1510
|
+
}
|
|
1511
|
+
simdutf_warn_unused bool validate_utf16_as_ascii(const char16_t *input,
|
|
1512
|
+
size_t length) noexcept {
|
|
1513
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1514
|
+
return validate_utf16be_as_ascii(input, length);
|
|
1515
|
+
#else
|
|
1516
|
+
return validate_utf16le_as_ascii(input, length);
|
|
1517
|
+
#endif
|
|
1518
|
+
}
|
|
1519
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_ASCII
|
|
1520
|
+
|
|
1521
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1522
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16(
|
|
1523
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1524
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1525
|
+
return convert_utf8_to_utf16be(input, length, utf16_output);
|
|
1526
|
+
#else
|
|
1527
|
+
return convert_utf8_to_utf16le(input, length, utf16_output);
|
|
1528
|
+
#endif
|
|
1529
|
+
}
|
|
1530
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1531
|
+
|
|
1532
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1533
|
+
simdutf_warn_unused size_t convert_latin1_to_utf8(const char *buf, size_t len,
|
|
1534
|
+
char *utf8_output) noexcept {
|
|
1535
|
+
return get_default_implementation()->convert_latin1_to_utf8(buf, len,
|
|
1536
|
+
utf8_output);
|
|
1537
|
+
}
|
|
1538
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1539
|
+
|
|
1540
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1541
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16le(
|
|
1542
|
+
const char *buf, size_t len, char16_t *utf16_output) noexcept {
|
|
1543
|
+
return get_default_implementation()->convert_latin1_to_utf16le(buf, len,
|
|
1544
|
+
utf16_output);
|
|
1545
|
+
}
|
|
1546
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16be(
|
|
1547
|
+
const char *buf, size_t len, char16_t *utf16_output) noexcept {
|
|
1548
|
+
return get_default_implementation()->convert_latin1_to_utf16be(buf, len,
|
|
1549
|
+
utf16_output);
|
|
1550
|
+
}
|
|
1551
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1552
|
+
|
|
1553
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
1554
|
+
simdutf_warn_unused size_t convert_latin1_to_utf32(
|
|
1555
|
+
const char *buf, size_t len, char32_t *latin1_output) noexcept {
|
|
1556
|
+
return get_default_implementation()->convert_latin1_to_utf32(buf, len,
|
|
1557
|
+
latin1_output);
|
|
1558
|
+
}
|
|
1559
|
+
// moved to the header file
|
|
1560
|
+
// simdutf_warn_unused size_t latin1_length_from_utf32(size_t length) noexcept
|
|
1561
|
+
// simdutf_warn_unused size_t utf32_length_from_latin1(size_t length) noexcept
|
|
1562
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
1563
|
+
|
|
1564
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1565
|
+
simdutf_warn_unused size_t convert_utf8_to_latin1(
|
|
1566
|
+
const char *buf, size_t len, char *latin1_output) noexcept {
|
|
1567
|
+
return get_default_implementation()->convert_utf8_to_latin1(buf, len,
|
|
1568
|
+
latin1_output);
|
|
1569
|
+
}
|
|
1570
|
+
simdutf_warn_unused result convert_utf8_to_latin1_with_errors(
|
|
1571
|
+
const char *buf, size_t len, char *latin1_output) noexcept {
|
|
1572
|
+
return get_default_implementation()->convert_utf8_to_latin1_with_errors(
|
|
1573
|
+
buf, len, latin1_output);
|
|
1574
|
+
}
|
|
1575
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_latin1(
|
|
1576
|
+
const char *buf, size_t len, char *latin1_output) noexcept {
|
|
1577
|
+
return get_default_implementation()->convert_valid_utf8_to_latin1(
|
|
1578
|
+
buf, len, latin1_output);
|
|
1579
|
+
}
|
|
1580
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
1581
|
+
|
|
1582
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1583
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16le(
|
|
1584
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1585
|
+
return get_default_implementation()->convert_utf8_to_utf16le(input, length,
|
|
1586
|
+
utf16_output);
|
|
1587
|
+
}
|
|
1588
|
+
simdutf_warn_unused size_t convert_utf8_to_utf16be(
|
|
1589
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1590
|
+
return get_default_implementation()->convert_utf8_to_utf16be(input, length,
|
|
1591
|
+
utf16_output);
|
|
1592
|
+
}
|
|
1593
|
+
simdutf_warn_unused result convert_utf8_to_utf16_with_errors(
|
|
1594
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1595
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1596
|
+
return convert_utf8_to_utf16be_with_errors(input, length, utf16_output);
|
|
1597
|
+
#else
|
|
1598
|
+
return convert_utf8_to_utf16le_with_errors(input, length, utf16_output);
|
|
1599
|
+
#endif
|
|
1600
|
+
}
|
|
1601
|
+
simdutf_warn_unused result convert_utf8_to_utf16le_with_errors(
|
|
1602
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1603
|
+
return get_default_implementation()->convert_utf8_to_utf16le_with_errors(
|
|
1604
|
+
input, length, utf16_output);
|
|
1605
|
+
}
|
|
1606
|
+
simdutf_warn_unused result convert_utf8_to_utf16be_with_errors(
|
|
1607
|
+
const char *input, size_t length, char16_t *utf16_output) noexcept {
|
|
1608
|
+
return get_default_implementation()->convert_utf8_to_utf16be_with_errors(
|
|
1609
|
+
input, length, utf16_output);
|
|
1610
|
+
}
|
|
1611
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1612
|
+
|
|
1613
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1614
|
+
simdutf_warn_unused size_t convert_utf8_to_utf32(
|
|
1615
|
+
const char *input, size_t length, char32_t *utf32_output) noexcept {
|
|
1616
|
+
return get_default_implementation()->convert_utf8_to_utf32(input, length,
|
|
1617
|
+
utf32_output);
|
|
1618
|
+
}
|
|
1619
|
+
simdutf_warn_unused result convert_utf8_to_utf32_with_errors(
|
|
1620
|
+
const char *input, size_t length, char32_t *utf32_output) noexcept {
|
|
1621
|
+
return get_default_implementation()->convert_utf8_to_utf32_with_errors(
|
|
1622
|
+
input, length, utf32_output);
|
|
1623
|
+
}
|
|
1624
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1625
|
+
|
|
1626
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
1627
|
+
simdutf_warn_unused bool validate_utf16(const char16_t *buf,
|
|
1628
|
+
size_t len) noexcept {
|
|
1629
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1630
|
+
return validate_utf16be(buf, len);
|
|
1631
|
+
#else
|
|
1632
|
+
return validate_utf16le(buf, len);
|
|
1633
|
+
#endif
|
|
1634
|
+
}
|
|
1635
|
+
void to_well_formed_utf16be(const char16_t *input, size_t len,
|
|
1636
|
+
char16_t *output) noexcept {
|
|
1637
|
+
return get_default_implementation()->to_well_formed_utf16be(input, len,
|
|
1638
|
+
output);
|
|
1639
|
+
}
|
|
1640
|
+
void to_well_formed_utf16le(const char16_t *input, size_t len,
|
|
1641
|
+
char16_t *output) noexcept {
|
|
1642
|
+
return get_default_implementation()->to_well_formed_utf16le(input, len,
|
|
1643
|
+
output);
|
|
1644
|
+
}
|
|
1645
|
+
void to_well_formed_utf16(const char16_t *input, size_t len,
|
|
1646
|
+
char16_t *output) noexcept {
|
|
1647
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1648
|
+
to_well_formed_utf16be(input, len, output);
|
|
1649
|
+
#else
|
|
1650
|
+
to_well_formed_utf16le(input, len, output);
|
|
1651
|
+
#endif
|
|
1652
|
+
}
|
|
1653
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
1654
|
+
|
|
1655
|
+
#if SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
1656
|
+
simdutf_warn_unused bool validate_utf16le(const char16_t *buf,
|
|
1657
|
+
size_t len) noexcept {
|
|
1658
|
+
return get_default_implementation()->validate_utf16le(buf, len);
|
|
1659
|
+
}
|
|
1660
|
+
#endif // SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING
|
|
1661
|
+
|
|
1662
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
1663
|
+
#if SIMDUTF_ATOMIC_REF
|
|
1664
|
+
template <typename char_type>
|
|
1665
|
+
simdutf_warn_unused result atomic_base64_to_binary_safe_impl(
|
|
1666
|
+
const char_type *input, size_t length, char *output, size_t &outlen,
|
|
1667
|
+
base64_options options,
|
|
1668
|
+
last_chunk_handling_options last_chunk_handling_options,
|
|
1669
|
+
bool decode_up_to_bad_char) noexcept {
|
|
1670
|
+
#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
|
1671
|
+
// We use a smaller buffer during fuzzing to more easily detect bugs.
|
|
1672
|
+
constexpr size_t buffer_size = 128;
|
|
1673
|
+
#else
|
|
1674
|
+
// Arbitrary block sizes: 4KB for input.
|
|
1675
|
+
constexpr size_t buffer_size = 4096;
|
|
1676
|
+
#endif
|
|
1677
|
+
std::array<char, buffer_size> temp_buffer;
|
|
1678
|
+
const char_type *const input_init = input;
|
|
1679
|
+
size_t actual_out = 0;
|
|
1680
|
+
bool last_chunk = false;
|
|
1681
|
+
const size_t length_init = length;
|
|
1682
|
+
result r;
|
|
1683
|
+
while (!last_chunk) {
|
|
1684
|
+
last_chunk |= (temp_buffer.size() >= outlen - actual_out);
|
|
1685
|
+
size_t temp_outlen = (std::min)(temp_buffer.size(), outlen - actual_out);
|
|
1686
|
+
r = base64_to_binary_safe(input, length, temp_buffer.data(), temp_outlen,
|
|
1687
|
+
options, last_chunk_handling_options,
|
|
1688
|
+
decode_up_to_bad_char);
|
|
1689
|
+
// We processed r.count characters of input.
|
|
1690
|
+
// We wrote temp_outlen bytes to temp_buffer.
|
|
1691
|
+
// If there is no ignorable characters,
|
|
1692
|
+
// we should expect that values/4.0*3 == temp_outlen,
|
|
1693
|
+
// except maybe at the tail end of the string.
|
|
1694
|
+
|
|
1695
|
+
//
|
|
1696
|
+
// We are assuming that when r.error == error_code::OUTPUT_BUFFER_TOO_SMALL,
|
|
1697
|
+
// we truncate the results so that a number of base64 characters divisible
|
|
1698
|
+
// by four is processed.
|
|
1699
|
+
//
|
|
1700
|
+
|
|
1701
|
+
//
|
|
1702
|
+
// We wrote temp_outlen bytes to temp_buffer.
|
|
1703
|
+
// We need to copy them to output.
|
|
1704
|
+
// Copy with relaxed atomic operations to the output
|
|
1705
|
+
simdutf_log_assert(temp_outlen <= outlen - actual_out,
|
|
1706
|
+
"Output buffer is too small");
|
|
1707
|
+
simdutf_log_assert(temp_outlen <= temp_buffer.size(),
|
|
1708
|
+
"Output buffer is too small");
|
|
1709
|
+
|
|
1710
|
+
simdutf::scalar::memcpy_atomic_write(output + actual_out,
|
|
1711
|
+
temp_buffer.data(), temp_outlen);
|
|
1712
|
+
actual_out += temp_outlen;
|
|
1713
|
+
length -= r.count;
|
|
1714
|
+
input += r.count;
|
|
1715
|
+
|
|
1716
|
+
if (r.error != error_code::OUTPUT_BUFFER_TOO_SMALL) {
|
|
1717
|
+
break;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
if (size_t(input - input_init) != length_init) {
|
|
1721
|
+
// We did not process all input characters. In such case, we
|
|
1722
|
+
// should not end with an ignorable character. See
|
|
1723
|
+
// https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
|
|
1724
|
+
while (input > input_init && base64_ignorable(*(input - 1), options)) {
|
|
1725
|
+
--input;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
outlen = actual_out;
|
|
1729
|
+
return {r.error, size_t(input - input_init)};
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
simdutf_warn_unused result atomic_base64_to_binary_safe(
|
|
1733
|
+
const char *input, size_t length, char *output, size_t &outlen,
|
|
1734
|
+
base64_options options,
|
|
1735
|
+
last_chunk_handling_options last_chunk_handling_options,
|
|
1736
|
+
bool decode_up_to_bad_char) noexcept {
|
|
1737
|
+
return atomic_base64_to_binary_safe_impl<char>(
|
|
1738
|
+
input, length, output, outlen, options, last_chunk_handling_options,
|
|
1739
|
+
decode_up_to_bad_char);
|
|
1740
|
+
}
|
|
1741
|
+
simdutf_warn_unused result atomic_base64_to_binary_safe(
|
|
1742
|
+
const char16_t *input, size_t length, char *output, size_t &outlen,
|
|
1743
|
+
base64_options options,
|
|
1744
|
+
last_chunk_handling_options last_chunk_handling_options,
|
|
1745
|
+
bool decode_up_to_bad_char) noexcept {
|
|
1746
|
+
return atomic_base64_to_binary_safe_impl<char16_t>(
|
|
1747
|
+
input, length, output, outlen, options, last_chunk_handling_options,
|
|
1748
|
+
decode_up_to_bad_char);
|
|
1749
|
+
}
|
|
1750
|
+
#endif // SIMDUTF_ATOMIC_REF
|
|
1751
|
+
|
|
1752
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
1753
|
+
|
|
1754
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
1755
|
+
simdutf_warn_unused bool validate_utf16be(const char16_t *buf,
|
|
1756
|
+
size_t len) noexcept {
|
|
1757
|
+
return get_default_implementation()->validate_utf16be(buf, len);
|
|
1758
|
+
}
|
|
1759
|
+
simdutf_warn_unused result validate_utf16_with_errors(const char16_t *buf,
|
|
1760
|
+
size_t len) noexcept {
|
|
1761
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1762
|
+
return validate_utf16be_with_errors(buf, len);
|
|
1763
|
+
#else
|
|
1764
|
+
return validate_utf16le_with_errors(buf, len);
|
|
1765
|
+
#endif
|
|
1766
|
+
}
|
|
1767
|
+
simdutf_warn_unused result validate_utf16le_with_errors(const char16_t *buf,
|
|
1768
|
+
size_t len) noexcept {
|
|
1769
|
+
return get_default_implementation()->validate_utf16le_with_errors(buf, len);
|
|
1770
|
+
}
|
|
1771
|
+
simdutf_warn_unused result validate_utf16be_with_errors(const char16_t *buf,
|
|
1772
|
+
size_t len) noexcept {
|
|
1773
|
+
return get_default_implementation()->validate_utf16be_with_errors(buf, len);
|
|
1774
|
+
}
|
|
1775
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
1776
|
+
|
|
1777
|
+
#if SIMDUTF_FEATURE_UTF32
|
|
1778
|
+
simdutf_warn_unused bool validate_utf32(const char32_t *buf,
|
|
1779
|
+
size_t len) noexcept {
|
|
1780
|
+
return get_default_implementation()->validate_utf32(buf, len);
|
|
1781
|
+
}
|
|
1782
|
+
simdutf_warn_unused result validate_utf32_with_errors(const char32_t *buf,
|
|
1783
|
+
size_t len) noexcept {
|
|
1784
|
+
return get_default_implementation()->validate_utf32_with_errors(buf, len);
|
|
1785
|
+
}
|
|
1786
|
+
#endif // SIMDUTF_FEATURE_UTF32
|
|
1787
|
+
|
|
1788
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1789
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16(
|
|
1790
|
+
const char *input, size_t length, char16_t *utf16_buffer) noexcept {
|
|
1791
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1792
|
+
return convert_valid_utf8_to_utf16be(input, length, utf16_buffer);
|
|
1793
|
+
#else
|
|
1794
|
+
return convert_valid_utf8_to_utf16le(input, length, utf16_buffer);
|
|
1795
|
+
#endif
|
|
1796
|
+
}
|
|
1797
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16le(
|
|
1798
|
+
const char *input, size_t length, char16_t *utf16_buffer) noexcept {
|
|
1799
|
+
return get_default_implementation()->convert_valid_utf8_to_utf16le(
|
|
1800
|
+
input, length, utf16_buffer);
|
|
1801
|
+
}
|
|
1802
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf16be(
|
|
1803
|
+
const char *input, size_t length, char16_t *utf16_buffer) noexcept {
|
|
1804
|
+
return get_default_implementation()->convert_valid_utf8_to_utf16be(
|
|
1805
|
+
input, length, utf16_buffer);
|
|
1806
|
+
}
|
|
1807
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1808
|
+
|
|
1809
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1810
|
+
simdutf_warn_unused size_t convert_valid_utf8_to_utf32(
|
|
1811
|
+
const char *input, size_t length, char32_t *utf32_buffer) noexcept {
|
|
1812
|
+
return get_default_implementation()->convert_valid_utf8_to_utf32(
|
|
1813
|
+
input, length, utf32_buffer);
|
|
1814
|
+
}
|
|
1815
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
1816
|
+
|
|
1817
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1818
|
+
simdutf_warn_unused size_t convert_utf16_to_utf8(const char16_t *buf,
|
|
1819
|
+
size_t len,
|
|
1820
|
+
char *utf8_buffer) noexcept {
|
|
1821
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1822
|
+
return convert_utf16be_to_utf8(buf, len, utf8_buffer);
|
|
1823
|
+
#else
|
|
1824
|
+
return convert_utf16le_to_utf8(buf, len, utf8_buffer);
|
|
1825
|
+
#endif
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
simdutf_warn_unused size_t
|
|
1829
|
+
convert_utf16_to_utf8_safe(const char16_t *buf, size_t len, char *utf8_output,
|
|
1830
|
+
size_t utf8_len) noexcept {
|
|
1831
|
+
const auto start{utf8_output};
|
|
1832
|
+
// We might be able to go faster by first scanning the input buffer to
|
|
1833
|
+
// determine how many char16_t characters we can read without exceeding the
|
|
1834
|
+
// utf8_len. This is a one-pass algorithm that has the benefit of not
|
|
1835
|
+
// requiring a first pass to determine the length.
|
|
1836
|
+
while (true) {
|
|
1837
|
+
// The worst case for convert_utf16_to_utf8 is when you go from 1 char16_t
|
|
1838
|
+
// to 3 characters of UTF-8. So we can read at most utf8_len / 3 char16_t
|
|
1839
|
+
// characters.
|
|
1840
|
+
auto read_len = std::min(len, utf8_len / 3);
|
|
1841
|
+
if (read_len <= 16) {
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
if (read_len < len) {
|
|
1845
|
+
// If we have a high surrogate at the end of the buffer, we need to
|
|
1846
|
+
// either read one more char16_t or backtrack.
|
|
1847
|
+
if (scalar::utf16::high_surrogate(buf[read_len - 1])) {
|
|
1848
|
+
read_len--;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
if (read_len == 0) {
|
|
1852
|
+
// If we cannot read anything, we are done.
|
|
1853
|
+
break;
|
|
1854
|
+
}
|
|
1855
|
+
const auto write_len =
|
|
1856
|
+
simdutf::convert_utf16_to_utf8(buf, read_len, utf8_output);
|
|
1857
|
+
if (write_len == 0) {
|
|
1858
|
+
// There was an error in the conversion, we cannot continue.
|
|
1859
|
+
return 0; // indicating failure
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
utf8_output += write_len;
|
|
1863
|
+
utf8_len -= write_len;
|
|
1864
|
+
buf += read_len;
|
|
1865
|
+
len -= read_len;
|
|
1866
|
+
}
|
|
1867
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1868
|
+
full_result r =
|
|
1869
|
+
scalar::utf16_to_utf8::convert_with_errors<endianness::BIG, true>(
|
|
1870
|
+
buf, len, utf8_output, utf8_len);
|
|
1871
|
+
#else
|
|
1872
|
+
full_result r =
|
|
1873
|
+
scalar::utf16_to_utf8::convert_with_errors<endianness::LITTLE, true>(
|
|
1874
|
+
buf, len, utf8_output, utf8_len);
|
|
1875
|
+
#endif
|
|
1876
|
+
if (r.error != error_code::SUCCESS &&
|
|
1877
|
+
r.error != error_code::OUTPUT_BUFFER_TOO_SMALL) {
|
|
1878
|
+
// If there was an error, we return 0 to indicate failure.
|
|
1879
|
+
return 0; // indicating failure
|
|
1880
|
+
}
|
|
1881
|
+
return r.output_count + (utf8_output - start);
|
|
1882
|
+
}
|
|
1883
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1884
|
+
|
|
1885
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1886
|
+
simdutf_warn_unused size_t convert_utf16_to_latin1(
|
|
1887
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1888
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1889
|
+
return convert_utf16be_to_latin1(buf, len, latin1_buffer);
|
|
1890
|
+
#else
|
|
1891
|
+
return convert_utf16le_to_latin1(buf, len, latin1_buffer);
|
|
1892
|
+
#endif
|
|
1893
|
+
}
|
|
1894
|
+
simdutf_warn_unused size_t convert_latin1_to_utf16(
|
|
1895
|
+
const char *buf, size_t len, char16_t *utf16_output) noexcept {
|
|
1896
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1897
|
+
return convert_latin1_to_utf16be(buf, len, utf16_output);
|
|
1898
|
+
#else
|
|
1899
|
+
return convert_latin1_to_utf16le(buf, len, utf16_output);
|
|
1900
|
+
#endif
|
|
1901
|
+
}
|
|
1902
|
+
simdutf_warn_unused size_t convert_utf16be_to_latin1(
|
|
1903
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1904
|
+
return get_default_implementation()->convert_utf16be_to_latin1(buf, len,
|
|
1905
|
+
latin1_buffer);
|
|
1906
|
+
}
|
|
1907
|
+
simdutf_warn_unused size_t convert_utf16le_to_latin1(
|
|
1908
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1909
|
+
return get_default_implementation()->convert_utf16le_to_latin1(buf, len,
|
|
1910
|
+
latin1_buffer);
|
|
1911
|
+
}
|
|
1912
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_latin1(
|
|
1913
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1914
|
+
return get_default_implementation()->convert_valid_utf16be_to_latin1(
|
|
1915
|
+
buf, len, latin1_buffer);
|
|
1916
|
+
}
|
|
1917
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_latin1(
|
|
1918
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1919
|
+
return get_default_implementation()->convert_valid_utf16le_to_latin1(
|
|
1920
|
+
buf, len, latin1_buffer);
|
|
1921
|
+
}
|
|
1922
|
+
simdutf_warn_unused result convert_utf16le_to_latin1_with_errors(
|
|
1923
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1924
|
+
return get_default_implementation()->convert_utf16le_to_latin1_with_errors(
|
|
1925
|
+
buf, len, latin1_buffer);
|
|
1926
|
+
}
|
|
1927
|
+
simdutf_warn_unused result convert_utf16be_to_latin1_with_errors(
|
|
1928
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1929
|
+
return get_default_implementation()->convert_utf16be_to_latin1_with_errors(
|
|
1930
|
+
buf, len, latin1_buffer);
|
|
1931
|
+
}
|
|
1932
|
+
// moved to header file
|
|
1933
|
+
// simdutf_warn_unused size_t latin1_length_from_utf16(size_t length) noexcept
|
|
1934
|
+
// simdutf_warn_unused size_t utf16_length_from_latin1(size_t length) noexcept
|
|
1935
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1936
|
+
|
|
1937
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1938
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf8(const char16_t *buf,
|
|
1939
|
+
size_t len,
|
|
1940
|
+
char *utf8_buffer) noexcept {
|
|
1941
|
+
return get_default_implementation()->convert_utf16le_to_utf8(buf, len,
|
|
1942
|
+
utf8_buffer);
|
|
1943
|
+
}
|
|
1944
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf8(const char16_t *buf,
|
|
1945
|
+
size_t len,
|
|
1946
|
+
char *utf8_buffer) noexcept {
|
|
1947
|
+
return get_default_implementation()->convert_utf16be_to_utf8(buf, len,
|
|
1948
|
+
utf8_buffer);
|
|
1949
|
+
}
|
|
1950
|
+
simdutf_warn_unused result convert_utf16_to_utf8_with_errors(
|
|
1951
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
1952
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1953
|
+
return convert_utf16be_to_utf8_with_errors(buf, len, utf8_buffer);
|
|
1954
|
+
#else
|
|
1955
|
+
return convert_utf16le_to_utf8_with_errors(buf, len, utf8_buffer);
|
|
1956
|
+
#endif
|
|
1957
|
+
}
|
|
1958
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1959
|
+
|
|
1960
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1961
|
+
simdutf_warn_unused result convert_utf16_to_latin1_with_errors(
|
|
1962
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1963
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1964
|
+
return convert_utf16be_to_latin1_with_errors(buf, len, latin1_buffer);
|
|
1965
|
+
#else
|
|
1966
|
+
return convert_utf16le_to_latin1_with_errors(buf, len, latin1_buffer);
|
|
1967
|
+
#endif
|
|
1968
|
+
}
|
|
1969
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1970
|
+
|
|
1971
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1972
|
+
simdutf_warn_unused result convert_utf16le_to_utf8_with_errors(
|
|
1973
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
1974
|
+
return get_default_implementation()->convert_utf16le_to_utf8_with_errors(
|
|
1975
|
+
buf, len, utf8_buffer);
|
|
1976
|
+
}
|
|
1977
|
+
simdutf_warn_unused result convert_utf16be_to_utf8_with_errors(
|
|
1978
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
1979
|
+
return get_default_implementation()->convert_utf16be_to_utf8_with_errors(
|
|
1980
|
+
buf, len, utf8_buffer);
|
|
1981
|
+
}
|
|
1982
|
+
simdutf_warn_unused size_t convert_valid_utf16_to_utf8(
|
|
1983
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
1984
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1985
|
+
return convert_valid_utf16be_to_utf8(buf, len, utf8_buffer);
|
|
1986
|
+
#else
|
|
1987
|
+
return convert_valid_utf16le_to_utf8(buf, len, utf8_buffer);
|
|
1988
|
+
#endif
|
|
1989
|
+
}
|
|
1990
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
1991
|
+
|
|
1992
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
1993
|
+
simdutf_warn_unused size_t convert_valid_utf16_to_latin1(
|
|
1994
|
+
const char16_t *buf, size_t len, char *latin1_buffer) noexcept {
|
|
1995
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
1996
|
+
return convert_valid_utf16be_to_latin1(buf, len, latin1_buffer);
|
|
1997
|
+
#else
|
|
1998
|
+
return convert_valid_utf16le_to_latin1(buf, len, latin1_buffer);
|
|
1999
|
+
#endif
|
|
2000
|
+
}
|
|
2001
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_LATIN1
|
|
2002
|
+
|
|
2003
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2004
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf8(
|
|
2005
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
2006
|
+
return get_default_implementation()->convert_valid_utf16le_to_utf8(
|
|
2007
|
+
buf, len, utf8_buffer);
|
|
2008
|
+
}
|
|
2009
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf8(
|
|
2010
|
+
const char16_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
2011
|
+
return get_default_implementation()->convert_valid_utf16be_to_utf8(
|
|
2012
|
+
buf, len, utf8_buffer);
|
|
2013
|
+
}
|
|
2014
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2015
|
+
|
|
2016
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2017
|
+
simdutf_warn_unused size_t convert_utf32_to_utf8(const char32_t *buf,
|
|
2018
|
+
size_t len,
|
|
2019
|
+
char *utf8_buffer) noexcept {
|
|
2020
|
+
return get_default_implementation()->convert_utf32_to_utf8(buf, len,
|
|
2021
|
+
utf8_buffer);
|
|
2022
|
+
}
|
|
2023
|
+
simdutf_warn_unused result convert_utf32_to_utf8_with_errors(
|
|
2024
|
+
const char32_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
2025
|
+
return get_default_implementation()->convert_utf32_to_utf8_with_errors(
|
|
2026
|
+
buf, len, utf8_buffer);
|
|
2027
|
+
}
|
|
2028
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf8(
|
|
2029
|
+
const char32_t *buf, size_t len, char *utf8_buffer) noexcept {
|
|
2030
|
+
return get_default_implementation()->convert_valid_utf32_to_utf8(buf, len,
|
|
2031
|
+
utf8_buffer);
|
|
2032
|
+
}
|
|
2033
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2034
|
+
|
|
2035
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2036
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16(
|
|
2037
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2038
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2039
|
+
return convert_utf32_to_utf16be(buf, len, utf16_buffer);
|
|
2040
|
+
#else
|
|
2041
|
+
return convert_utf32_to_utf16le(buf, len, utf16_buffer);
|
|
2042
|
+
#endif
|
|
2043
|
+
}
|
|
2044
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2045
|
+
|
|
2046
|
+
#if SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
2047
|
+
simdutf_warn_unused size_t convert_utf32_to_latin1(
|
|
2048
|
+
const char32_t *input, size_t length, char *latin1_output) noexcept {
|
|
2049
|
+
return get_default_implementation()->convert_utf32_to_latin1(input, length,
|
|
2050
|
+
latin1_output);
|
|
2051
|
+
}
|
|
2052
|
+
simdutf_warn_unused result convert_utf32_to_latin1_with_errors(
|
|
2053
|
+
const char32_t *input, size_t length, char *latin1_buffer) noexcept {
|
|
2054
|
+
return get_default_implementation()->convert_utf32_to_latin1_with_errors(
|
|
2055
|
+
input, length, latin1_buffer);
|
|
2056
|
+
}
|
|
2057
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_latin1(
|
|
2058
|
+
const char32_t *input, size_t length, char *latin1_buffer) noexcept {
|
|
2059
|
+
return get_default_implementation()->convert_valid_utf32_to_latin1(
|
|
2060
|
+
input, length, latin1_buffer);
|
|
2061
|
+
}
|
|
2062
|
+
#endif // SIMDUTF_FEATURE_UTF32 && SIMDUTF_FEATURE_LATIN1
|
|
2063
|
+
|
|
2064
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2065
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16le(
|
|
2066
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2067
|
+
return get_default_implementation()->convert_utf32_to_utf16le(buf, len,
|
|
2068
|
+
utf16_buffer);
|
|
2069
|
+
}
|
|
2070
|
+
simdutf_warn_unused size_t convert_utf32_to_utf16be(
|
|
2071
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2072
|
+
return get_default_implementation()->convert_utf32_to_utf16be(buf, len,
|
|
2073
|
+
utf16_buffer);
|
|
2074
|
+
}
|
|
2075
|
+
simdutf_warn_unused result convert_utf32_to_utf16_with_errors(
|
|
2076
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2077
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2078
|
+
return convert_utf32_to_utf16be_with_errors(buf, len, utf16_buffer);
|
|
2079
|
+
#else
|
|
2080
|
+
return convert_utf32_to_utf16le_with_errors(buf, len, utf16_buffer);
|
|
2081
|
+
#endif
|
|
2082
|
+
}
|
|
2083
|
+
simdutf_warn_unused result convert_utf32_to_utf16le_with_errors(
|
|
2084
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2085
|
+
return get_default_implementation()->convert_utf32_to_utf16le_with_errors(
|
|
2086
|
+
buf, len, utf16_buffer);
|
|
2087
|
+
}
|
|
2088
|
+
simdutf_warn_unused result convert_utf32_to_utf16be_with_errors(
|
|
2089
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2090
|
+
return get_default_implementation()->convert_utf32_to_utf16be_with_errors(
|
|
2091
|
+
buf, len, utf16_buffer);
|
|
2092
|
+
}
|
|
2093
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16(
|
|
2094
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2095
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2096
|
+
return convert_valid_utf32_to_utf16be(buf, len, utf16_buffer);
|
|
2097
|
+
#else
|
|
2098
|
+
return convert_valid_utf32_to_utf16le(buf, len, utf16_buffer);
|
|
2099
|
+
#endif
|
|
2100
|
+
}
|
|
2101
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16le(
|
|
2102
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2103
|
+
return get_default_implementation()->convert_valid_utf32_to_utf16le(
|
|
2104
|
+
buf, len, utf16_buffer);
|
|
2105
|
+
}
|
|
2106
|
+
simdutf_warn_unused size_t convert_valid_utf32_to_utf16be(
|
|
2107
|
+
const char32_t *buf, size_t len, char16_t *utf16_buffer) noexcept {
|
|
2108
|
+
return get_default_implementation()->convert_valid_utf32_to_utf16be(
|
|
2109
|
+
buf, len, utf16_buffer);
|
|
2110
|
+
}
|
|
2111
|
+
simdutf_warn_unused size_t convert_utf16_to_utf32(
|
|
2112
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2113
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2114
|
+
return convert_utf16be_to_utf32(buf, len, utf32_buffer);
|
|
2115
|
+
#else
|
|
2116
|
+
return convert_utf16le_to_utf32(buf, len, utf32_buffer);
|
|
2117
|
+
#endif
|
|
2118
|
+
}
|
|
2119
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf32(
|
|
2120
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2121
|
+
return get_default_implementation()->convert_utf16le_to_utf32(buf, len,
|
|
2122
|
+
utf32_buffer);
|
|
2123
|
+
}
|
|
2124
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf32(
|
|
2125
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2126
|
+
return get_default_implementation()->convert_utf16be_to_utf32(buf, len,
|
|
2127
|
+
utf32_buffer);
|
|
2128
|
+
}
|
|
2129
|
+
simdutf_warn_unused result convert_utf16_to_utf32_with_errors(
|
|
2130
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2131
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2132
|
+
return convert_utf16be_to_utf32_with_errors(buf, len, utf32_buffer);
|
|
2133
|
+
#else
|
|
2134
|
+
return convert_utf16le_to_utf32_with_errors(buf, len, utf32_buffer);
|
|
2135
|
+
#endif
|
|
2136
|
+
}
|
|
2137
|
+
simdutf_warn_unused result convert_utf16le_to_utf32_with_errors(
|
|
2138
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2139
|
+
return get_default_implementation()->convert_utf16le_to_utf32_with_errors(
|
|
2140
|
+
buf, len, utf32_buffer);
|
|
2141
|
+
}
|
|
2142
|
+
simdutf_warn_unused result convert_utf16be_to_utf32_with_errors(
|
|
2143
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2144
|
+
return get_default_implementation()->convert_utf16be_to_utf32_with_errors(
|
|
2145
|
+
buf, len, utf32_buffer);
|
|
2146
|
+
}
|
|
2147
|
+
simdutf_warn_unused size_t convert_valid_utf16_to_utf32(
|
|
2148
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2149
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2150
|
+
return convert_valid_utf16be_to_utf32(buf, len, utf32_buffer);
|
|
2151
|
+
#else
|
|
2152
|
+
return convert_valid_utf16le_to_utf32(buf, len, utf32_buffer);
|
|
2153
|
+
#endif
|
|
2154
|
+
}
|
|
2155
|
+
simdutf_warn_unused size_t convert_valid_utf16le_to_utf32(
|
|
2156
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2157
|
+
return get_default_implementation()->convert_valid_utf16le_to_utf32(
|
|
2158
|
+
buf, len, utf32_buffer);
|
|
2159
|
+
}
|
|
2160
|
+
simdutf_warn_unused size_t convert_valid_utf16be_to_utf32(
|
|
2161
|
+
const char16_t *buf, size_t len, char32_t *utf32_buffer) noexcept {
|
|
2162
|
+
return get_default_implementation()->convert_valid_utf16be_to_utf32(
|
|
2163
|
+
buf, len, utf32_buffer);
|
|
2164
|
+
}
|
|
2165
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2166
|
+
|
|
2167
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
2168
|
+
void change_endianness_utf16(const char16_t *input, size_t length,
|
|
2169
|
+
char16_t *output) noexcept {
|
|
2170
|
+
get_default_implementation()->change_endianness_utf16(input, length, output);
|
|
2171
|
+
}
|
|
2172
|
+
simdutf_warn_unused size_t count_utf16(const char16_t *input,
|
|
2173
|
+
size_t length) noexcept {
|
|
2174
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2175
|
+
return count_utf16be(input, length);
|
|
2176
|
+
#else
|
|
2177
|
+
return count_utf16le(input, length);
|
|
2178
|
+
#endif
|
|
2179
|
+
}
|
|
2180
|
+
simdutf_warn_unused size_t count_utf16le(const char16_t *input,
|
|
2181
|
+
size_t length) noexcept {
|
|
2182
|
+
return get_default_implementation()->count_utf16le(input, length);
|
|
2183
|
+
}
|
|
2184
|
+
simdutf_warn_unused size_t count_utf16be(const char16_t *input,
|
|
2185
|
+
size_t length) noexcept {
|
|
2186
|
+
return get_default_implementation()->count_utf16be(input, length);
|
|
2187
|
+
}
|
|
2188
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
2189
|
+
|
|
2190
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2191
|
+
simdutf_warn_unused size_t count_utf8(const char *input,
|
|
2192
|
+
size_t length) noexcept {
|
|
2193
|
+
return get_default_implementation()->count_utf8(input, length);
|
|
2194
|
+
}
|
|
2195
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2196
|
+
|
|
2197
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2198
|
+
simdutf_warn_unused size_t latin1_length_from_utf8(const char *buf,
|
|
2199
|
+
size_t len) noexcept {
|
|
2200
|
+
return get_default_implementation()->latin1_length_from_utf8(buf, len);
|
|
2201
|
+
}
|
|
2202
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2203
|
+
|
|
2204
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2205
|
+
simdutf_warn_unused size_t utf8_length_from_latin1(const char *buf,
|
|
2206
|
+
size_t len) noexcept {
|
|
2207
|
+
return get_default_implementation()->utf8_length_from_latin1(buf, len);
|
|
2208
|
+
}
|
|
2209
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2210
|
+
|
|
2211
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2212
|
+
simdutf_warn_unused size_t utf8_length_from_utf16(const char16_t *input,
|
|
2213
|
+
size_t length) noexcept {
|
|
2214
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2215
|
+
return utf8_length_from_utf16be(input, length);
|
|
2216
|
+
#else
|
|
2217
|
+
return utf8_length_from_utf16le(input, length);
|
|
2218
|
+
#endif
|
|
2219
|
+
}
|
|
2220
|
+
simdutf_warn_unused result utf8_length_from_utf16_with_replacement(
|
|
2221
|
+
const char16_t *input, size_t length) noexcept {
|
|
2222
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2223
|
+
return utf8_length_from_utf16be_with_replacement(input, length);
|
|
2224
|
+
#else
|
|
2225
|
+
return utf8_length_from_utf16le_with_replacement(input, length);
|
|
2226
|
+
#endif
|
|
2227
|
+
}
|
|
2228
|
+
simdutf_warn_unused size_t utf8_length_from_utf16le(const char16_t *input,
|
|
2229
|
+
size_t length) noexcept {
|
|
2230
|
+
return get_default_implementation()->utf8_length_from_utf16le(input, length);
|
|
2231
|
+
}
|
|
2232
|
+
simdutf_warn_unused size_t utf8_length_from_utf16be(const char16_t *input,
|
|
2233
|
+
size_t length) noexcept {
|
|
2234
|
+
return get_default_implementation()->utf8_length_from_utf16be(input, length);
|
|
2235
|
+
}
|
|
2236
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2237
|
+
|
|
2238
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2239
|
+
simdutf_warn_unused size_t utf32_length_from_utf16(const char16_t *input,
|
|
2240
|
+
size_t length) noexcept {
|
|
2241
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2242
|
+
return utf32_length_from_utf16be(input, length);
|
|
2243
|
+
#else
|
|
2244
|
+
return utf32_length_from_utf16le(input, length);
|
|
2245
|
+
#endif
|
|
2246
|
+
}
|
|
2247
|
+
simdutf_warn_unused size_t utf32_length_from_utf16le(const char16_t *input,
|
|
2248
|
+
size_t length) noexcept {
|
|
2249
|
+
return get_default_implementation()->utf32_length_from_utf16le(input, length);
|
|
2250
|
+
}
|
|
2251
|
+
simdutf_warn_unused size_t utf32_length_from_utf16be(const char16_t *input,
|
|
2252
|
+
size_t length) noexcept {
|
|
2253
|
+
return get_default_implementation()->utf32_length_from_utf16be(input, length);
|
|
2254
|
+
}
|
|
2255
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2256
|
+
|
|
2257
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2258
|
+
simdutf_warn_unused size_t utf16_length_from_utf8(const char *input,
|
|
2259
|
+
size_t length) noexcept {
|
|
2260
|
+
return get_default_implementation()->utf16_length_from_utf8(input, length);
|
|
2261
|
+
}
|
|
2262
|
+
simdutf_warn_unused result utf8_length_from_utf16le_with_replacement(
|
|
2263
|
+
const char16_t *input, size_t length) noexcept {
|
|
2264
|
+
return get_default_implementation()
|
|
2265
|
+
->utf8_length_from_utf16le_with_replacement(input, length);
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
simdutf_warn_unused result utf8_length_from_utf16be_with_replacement(
|
|
2269
|
+
const char16_t *input, size_t length) noexcept {
|
|
2270
|
+
return get_default_implementation()
|
|
2271
|
+
->utf8_length_from_utf16be_with_replacement(input, length);
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
simdutf_warn_unused size_t convert_utf16_to_utf8_with_replacement(
|
|
2275
|
+
const char16_t *input, size_t length, char *utf8_buffer) noexcept {
|
|
2276
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2277
|
+
return convert_utf16be_to_utf8_with_replacement(input, length, utf8_buffer);
|
|
2278
|
+
#else
|
|
2279
|
+
return convert_utf16le_to_utf8_with_replacement(input, length, utf8_buffer);
|
|
2280
|
+
#endif
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
simdutf_warn_unused size_t convert_utf16le_to_utf8_with_replacement(
|
|
2284
|
+
const char16_t *input, size_t length, char *utf8_buffer) noexcept {
|
|
2285
|
+
return get_default_implementation()->convert_utf16le_to_utf8_with_replacement(
|
|
2286
|
+
input, length, utf8_buffer);
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
simdutf_warn_unused size_t convert_utf16be_to_utf8_with_replacement(
|
|
2290
|
+
const char16_t *input, size_t length, char *utf8_buffer) noexcept {
|
|
2291
|
+
return get_default_implementation()->convert_utf16be_to_utf8_with_replacement(
|
|
2292
|
+
input, length, utf8_buffer);
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF16
|
|
2296
|
+
|
|
2297
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2298
|
+
simdutf_warn_unused size_t utf8_length_from_utf32(const char32_t *input,
|
|
2299
|
+
size_t length) noexcept {
|
|
2300
|
+
return get_default_implementation()->utf8_length_from_utf32(input, length);
|
|
2301
|
+
}
|
|
2302
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2303
|
+
|
|
2304
|
+
#if SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2305
|
+
simdutf_warn_unused size_t utf16_length_from_utf32(const char32_t *input,
|
|
2306
|
+
size_t length) noexcept {
|
|
2307
|
+
return get_default_implementation()->utf16_length_from_utf32(input, length);
|
|
2308
|
+
}
|
|
2309
|
+
#endif // SIMDUTF_FEATURE_UTF16 && SIMDUTF_FEATURE_UTF32
|
|
2310
|
+
|
|
2311
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2312
|
+
simdutf_warn_unused size_t utf32_length_from_utf8(const char *input,
|
|
2313
|
+
size_t length) noexcept {
|
|
2314
|
+
return get_default_implementation()->utf32_length_from_utf8(input, length);
|
|
2315
|
+
}
|
|
2316
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_UTF32
|
|
2317
|
+
|
|
2318
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
2319
|
+
|
|
2320
|
+
// this has been moved to implementation.h
|
|
2321
|
+
// simdutf_warn_unused size_t
|
|
2322
|
+
// base64_length_from_binary(size_t length, base64_options option) noexcept;
|
|
2323
|
+
|
|
2324
|
+
// this has been moved to implementation.h
|
|
2325
|
+
// simdutf_warn_unused size_t base64_length_from_binary_with_lines(
|
|
2326
|
+
// size_t length, base64_options options, size_t line_length) noexcept;
|
|
2327
|
+
// }
|
|
2328
|
+
|
|
2329
|
+
simdutf_warn_unused const char *detail::find(const char *start, const char *end,
|
|
2330
|
+
char character) noexcept {
|
|
2331
|
+
return get_default_implementation()->find(start, end, character);
|
|
2332
|
+
}
|
|
2333
|
+
simdutf_warn_unused const char16_t *detail::find(const char16_t *start,
|
|
2334
|
+
const char16_t *end,
|
|
2335
|
+
char16_t character) noexcept {
|
|
2336
|
+
return get_default_implementation()->find(start, end, character);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
simdutf_warn_unused size_t
|
|
2340
|
+
maximal_binary_length_from_base64(const char *input, size_t length) noexcept {
|
|
2341
|
+
return get_default_implementation()->maximal_binary_length_from_base64(
|
|
2342
|
+
input, length);
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
simdutf_warn_unused result base64_to_binary(
|
|
2346
|
+
const char *input, size_t length, char *output, base64_options options,
|
|
2347
|
+
last_chunk_handling_options last_chunk_handling_options) noexcept {
|
|
2348
|
+
return get_default_implementation()->base64_to_binary(
|
|
2349
|
+
input, length, output, options, last_chunk_handling_options);
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
simdutf_warn_unused size_t maximal_binary_length_from_base64(
|
|
2353
|
+
const char16_t *input, size_t length) noexcept {
|
|
2354
|
+
return get_default_implementation()->maximal_binary_length_from_base64(
|
|
2355
|
+
input, length);
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
simdutf_warn_unused size_t binary_length_from_base64(const char *input,
|
|
2359
|
+
size_t length) noexcept {
|
|
2360
|
+
return get_default_implementation()->binary_length_from_base64(input, length);
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
simdutf_warn_unused size_t binary_length_from_base64(const char16_t *input,
|
|
2364
|
+
size_t length) noexcept {
|
|
2365
|
+
return get_default_implementation()->binary_length_from_base64(input, length);
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
simdutf_warn_unused result base64_to_binary(
|
|
2369
|
+
const char16_t *input, size_t length, char *output, base64_options options,
|
|
2370
|
+
last_chunk_handling_options last_chunk_handling_options) noexcept {
|
|
2371
|
+
return get_default_implementation()->base64_to_binary(
|
|
2372
|
+
input, length, output, options, last_chunk_handling_options);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
// moved to implementation.h
|
|
2376
|
+
// simdutf_warn_unused bool base64_ignorable(char input,
|
|
2377
|
+
// base64_options options) noexcept
|
|
2378
|
+
// simdutf_warn_unused bool base64_ignorable(char16_t input,
|
|
2379
|
+
// base64_options options) noexcept
|
|
2380
|
+
// simdutf_warn_unused bool base64_valid(char input,
|
|
2381
|
+
// base64_options options) noexcept
|
|
2382
|
+
// simdutf_warn_unused bool base64_valid(char16_t input,
|
|
2383
|
+
// base64_options options) noexcept
|
|
2384
|
+
// simdutf_warn_unused bool
|
|
2385
|
+
// base64_valid_or_padding(char input, base64_options options) noexcept
|
|
2386
|
+
// simdutf_warn_unused bool
|
|
2387
|
+
// base64_valid_or_padding(char16_t input, base64_options options) noexcept
|
|
2388
|
+
|
|
2389
|
+
// base64_to_binary_safe_impl is moved to
|
|
2390
|
+
// include/simdutf/base64_implementation.h
|
|
2391
|
+
|
|
2392
|
+
#if SIMDUTF_ATOMIC_REF
|
|
2393
|
+
size_t atomic_binary_to_base64(const char *input, size_t length, char *output,
|
|
2394
|
+
base64_options options) noexcept {
|
|
2395
|
+
size_t retval = 0;
|
|
2396
|
+
#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
|
2397
|
+
// We use a smaller buffer during fuzzing to more easily detect bugs.
|
|
2398
|
+
constexpr size_t input_block_size = 128 * 3;
|
|
2399
|
+
#else
|
|
2400
|
+
// Arbitrary block sizes: 3KB for input which produces 4KB in output.
|
|
2401
|
+
constexpr size_t input_block_size = 1024 * 3;
|
|
2402
|
+
#endif
|
|
2403
|
+
std::array<char, input_block_size> inbuf;
|
|
2404
|
+
for (size_t i = 0; i < length; i += input_block_size) {
|
|
2405
|
+
const size_t current_block_size = std::min(input_block_size, length - i);
|
|
2406
|
+
simdutf::scalar::memcpy_atomic_read(inbuf.data(), input + i,
|
|
2407
|
+
current_block_size);
|
|
2408
|
+
const size_t written = binary_to_base64(inbuf.data(), current_block_size,
|
|
2409
|
+
output + retval, options);
|
|
2410
|
+
retval += written;
|
|
2411
|
+
}
|
|
2412
|
+
return retval;
|
|
2413
|
+
}
|
|
2414
|
+
#endif // SIMDUTF_ATOMIC_REF
|
|
2415
|
+
|
|
2416
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
2417
|
+
|
|
2418
|
+
#if SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2419
|
+
simdutf_warn_unused size_t convert_latin1_to_utf8_safe(
|
|
2420
|
+
const char *buf, size_t len, char *utf8_output, size_t utf8_len) noexcept {
|
|
2421
|
+
const auto start{utf8_output};
|
|
2422
|
+
|
|
2423
|
+
while (true) {
|
|
2424
|
+
// convert_latin1_to_utf8 will never write more than input length * 2
|
|
2425
|
+
auto read_len = std::min(len, utf8_len >> 1);
|
|
2426
|
+
if (read_len <= 16) {
|
|
2427
|
+
break;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
const auto write_len =
|
|
2431
|
+
simdutf::convert_latin1_to_utf8(buf, read_len, utf8_output);
|
|
2432
|
+
|
|
2433
|
+
utf8_output += write_len;
|
|
2434
|
+
utf8_len -= write_len;
|
|
2435
|
+
buf += read_len;
|
|
2436
|
+
len -= read_len;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
utf8_output +=
|
|
2440
|
+
scalar::latin1_to_utf8::convert_safe(buf, len, utf8_output, utf8_len);
|
|
2441
|
+
|
|
2442
|
+
return utf8_output - start;
|
|
2443
|
+
}
|
|
2444
|
+
#endif // SIMDUTF_FEATURE_UTF8 && SIMDUTF_FEATURE_LATIN1
|
|
2445
|
+
|
|
2446
|
+
#if SIMDUTF_FEATURE_BASE64
|
|
2447
|
+
simdutf_warn_unused result
|
|
2448
|
+
base64_to_binary_safe(const char *input, size_t length, char *output,
|
|
2449
|
+
size_t &outlen, base64_options options,
|
|
2450
|
+
last_chunk_handling_options last_chunk_handling_options,
|
|
2451
|
+
bool decode_up_to_bad_char) noexcept {
|
|
2452
|
+
return base64_to_binary_safe_impl<char>(input, length, output, outlen,
|
|
2453
|
+
options, last_chunk_handling_options,
|
|
2454
|
+
decode_up_to_bad_char);
|
|
2455
|
+
}
|
|
2456
|
+
simdutf_warn_unused result
|
|
2457
|
+
base64_to_binary_safe(const char16_t *input, size_t length, char *output,
|
|
2458
|
+
size_t &outlen, base64_options options,
|
|
2459
|
+
last_chunk_handling_options last_chunk_handling_options,
|
|
2460
|
+
bool decode_up_to_bad_char) noexcept {
|
|
2461
|
+
return base64_to_binary_safe_impl<char16_t>(
|
|
2462
|
+
input, length, output, outlen, options, last_chunk_handling_options,
|
|
2463
|
+
decode_up_to_bad_char);
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
size_t binary_to_base64(const char *input, size_t length, char *output,
|
|
2467
|
+
base64_options options) noexcept {
|
|
2468
|
+
return get_default_implementation()->binary_to_base64(input, length, output,
|
|
2469
|
+
options);
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
size_t binary_to_base64_with_lines(const char *input, size_t length,
|
|
2473
|
+
char *output, size_t line_length,
|
|
2474
|
+
base64_options options) noexcept {
|
|
2475
|
+
return get_default_implementation()->binary_to_base64_with_lines(
|
|
2476
|
+
input, length, output, line_length, options);
|
|
2477
|
+
}
|
|
2478
|
+
#endif // SIMDUTF_FEATURE_BASE64
|
|
2479
|
+
|
|
2480
|
+
#if SIMDUTF_FEATURE_DETECT_ENCODING
|
|
2481
|
+
simdutf_warn_unused simdutf::encoding_type
|
|
2482
|
+
autodetect_encoding(const char *buf, size_t length) noexcept {
|
|
2483
|
+
return get_default_implementation()->autodetect_encoding(buf, length);
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
simdutf_warn_unused int detect_encodings(const char *buf,
|
|
2487
|
+
size_t length) noexcept {
|
|
2488
|
+
return get_default_implementation()->detect_encodings(buf, length);
|
|
2489
|
+
}
|
|
2490
|
+
#endif // SIMDUTF_FEATURE_DETECT_ENCODING
|
|
2491
|
+
|
|
2492
|
+
const implementation *builtin_implementation() {
|
|
2493
|
+
static const implementation *builtin_impl =
|
|
2494
|
+
get_available_implementations()[SIMDUTF_STRINGIFY(
|
|
2495
|
+
SIMDUTF_BUILTIN_IMPLEMENTATION)];
|
|
2496
|
+
return builtin_impl;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
#if SIMDUTF_FEATURE_UTF8
|
|
2500
|
+
simdutf_warn_unused size_t trim_partial_utf8(const char *input, size_t length) {
|
|
2501
|
+
return scalar::utf8::trim_partial_utf8(input, length);
|
|
2502
|
+
}
|
|
2503
|
+
#endif // SIMDUTF_FEATURE_UTF8
|
|
2504
|
+
|
|
2505
|
+
#if SIMDUTF_FEATURE_UTF16
|
|
2506
|
+
simdutf_warn_unused size_t trim_partial_utf16be(const char16_t *input,
|
|
2507
|
+
size_t length) {
|
|
2508
|
+
return scalar::utf16::trim_partial_utf16<BIG>(input, length);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
simdutf_warn_unused size_t trim_partial_utf16le(const char16_t *input,
|
|
2512
|
+
size_t length) {
|
|
2513
|
+
return scalar::utf16::trim_partial_utf16<LITTLE>(input, length);
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
simdutf_warn_unused size_t trim_partial_utf16(const char16_t *input,
|
|
2517
|
+
size_t length) {
|
|
2518
|
+
#if SIMDUTF_IS_BIG_ENDIAN
|
|
2519
|
+
return trim_partial_utf16be(input, length);
|
|
2520
|
+
#else
|
|
2521
|
+
return trim_partial_utf16le(input, length);
|
|
2522
|
+
#endif
|
|
2523
|
+
}
|
|
2524
|
+
#endif // SIMDUTF_FEATURE_UTF16
|
|
2525
|
+
|
|
2526
|
+
} // namespace simdutf
|