mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
deps: update simdutf to 5.0.0
PR-URL: https://github.com/nodejs/node/pull/52138 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
1 parent
0b853a7576
commit
3b41da9a56
2 files changed
+4467
-140
No files matched your search
Vendored
+4287
-135
File diff suppressed because it is too large.
Load diff
Vendored
+180
-5
@@ -1,4 +1,4 @@
|
||||
/* auto-generated on 2024-01-29 10:40:15 -0500. Do not edit! */
|
||||
/* auto-generated on 2024-03-18 10:58:28 -0400. Do not edit! */
|
||||
/* begin file include/simdutf.h */
|
||||
#ifndef SIMDUTF_H
|
||||
#define SIMDUTF_H
|
||||
@@ -142,6 +142,30 @@
|
||||
// s390 IBM system. Big endian.
|
||||
#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 64
|
||||
// RISC-V 64-bit
|
||||
#define SIMDUTF_IS_RISCV64 1
|
||||
|
||||
#if __clang_major__ >= 19
|
||||
// Does the compiler support target regions for RISC-V
|
||||
#define SIMDUTF_HAS_RVV_TARGET_REGION 1
|
||||
#endif
|
||||
|
||||
#if __riscv_v_intrinsic >= 11000 && !(__GNUC__ == 13 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 0)
|
||||
#define SIMDUTF_HAS_RVV_INTRINSICS 1
|
||||
#endif
|
||||
|
||||
#define SIMDUTF_HAS_ZVBB_INTRINSICS 0 // there is currently no way to detect this
|
||||
|
||||
#if SIMDUTF_HAS_RVV_INTRINSICS && __riscv_vector && __riscv_v_min_vlen >= 128 && __riscv_v_elen >= 64
|
||||
// RISC-V V extension
|
||||
#define SIMDUTF_IS_RVV 1
|
||||
#if SIMDUTF_HAS_ZVBB_INTRINSICS && __riscv_zvbb >= 1000000
|
||||
// RISC-V Vector Basic Bit-manipulation
|
||||
#define SIMDUTF_IS_ZVBB 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif defined(__loongarch_lp64)
|
||||
// LoongArch 64-bit
|
||||
#else
|
||||
// The simdutf library is designed
|
||||
// for 64-bit processors and it seems that you are not
|
||||
@@ -540,6 +564,8 @@ enum error_code {
|
||||
SURROGATE, // The decoded character must be not be in U+D800...DFFF (UTF-8 or UTF-32) OR
|
||||
// a high surrogate must be followed by a low surrogate and a low surrogate must be preceded by a high surrogate (UTF-16) OR
|
||||
// there must be no surrogate at all (Latin1)
|
||||
INVALID_BASE64_CHARACTER, // Found a character that cannot be part of a valid base64 string.
|
||||
BASE64_INPUT_REMAINDER, // The base64 input terminates with a single character, excluding padding (=).
|
||||
OTHER // Not related to validation/transcoding.
|
||||
};
|
||||
|
||||
@@ -567,14 +593,14 @@ SIMDUTF_DISABLE_UNDESIRED_WARNINGS
|
||||
#define SIMDUTF_SIMDUTF_VERSION_H
|
||||
|
||||
/** The version of simdutf being used (major.minor.revision) */
|
||||
#define SIMDUTF_VERSION "4.0.9"
|
||||
#define SIMDUTF_VERSION "5.0.0"
|
||||
|
||||
namespace simdutf {
|
||||
enum {
|
||||
/**
|
||||
* The major version (MAJOR.minor.revision) of simdutf being used.
|
||||
*/
|
||||
SIMDUTF_VERSION_MAJOR = 4,
|
||||
SIMDUTF_VERSION_MAJOR = 5,
|
||||
/**
|
||||
* The minor version (major.MINOR.revision) of simdutf being used.
|
||||
*/
|
||||
@@ -582,7 +608,7 @@ enum {
|
||||
/**
|
||||
* The revision (major.minor.REVISION) of simdutf being used.
|
||||
*/
|
||||
SIMDUTF_VERSION_REVISION = 9
|
||||
SIMDUTF_VERSION_REVISION = 0
|
||||
};
|
||||
} // namespace simdutf
|
||||
|
||||
@@ -654,6 +680,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace simdutf {
|
||||
namespace internal {
|
||||
|
||||
@@ -675,7 +702,9 @@ enum instruction_set {
|
||||
AVX512BW = 0x4000,
|
||||
AVX512VL = 0x8000,
|
||||
AVX512VBMI2 = 0x10000,
|
||||
AVX512VPOPCNTDQ = 0x2000
|
||||
AVX512VPOPCNTDQ = 0x2000,
|
||||
RVV = 0x4000,
|
||||
ZVBB = 0x8000,
|
||||
};
|
||||
|
||||
#if defined(__PPC64__)
|
||||
@@ -684,6 +713,40 @@ static inline uint32_t detect_supported_architectures() {
|
||||
return instruction_set::ALTIVEC;
|
||||
}
|
||||
|
||||
#elif SIMDUTF_IS_RISCV64
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <unistd.h>
|
||||
// We define these our selfs, for backwards compatibility
|
||||
struct simdutf_riscv_hwprobe { int64_t key; uint64_t value; };
|
||||
#define simdutf_riscv_hwprobe(...) syscall(258, __VA_ARGS__)
|
||||
#define SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0 4
|
||||
#define SIMDUTF_RISCV_HWPROBE_IMA_V (1 << 2)
|
||||
#define SIMDUTF_RISCV_HWPROBE_EXT_ZVBB (1 << 17)
|
||||
#endif
|
||||
|
||||
static inline uint32_t detect_supported_architectures() {
|
||||
uint32_t host_isa = instruction_set::DEFAULT;
|
||||
#if SIMDUTF_IS_RVV
|
||||
host_isa |= instruction_set::RVV;
|
||||
#endif
|
||||
#if SIMDUTF_IS_ZVBB
|
||||
host_isa |= instruction_set::ZVBB;
|
||||
#endif
|
||||
#if defined(__linux__)
|
||||
simdutf_riscv_hwprobe probes[] = { { SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0, 0 } };
|
||||
long ret = simdutf_riscv_hwprobe(&probes, sizeof probes/sizeof *probes, 0, nullptr, 0);
|
||||
if (ret == 0) {
|
||||
uint64_t extensions = probes[0].value;
|
||||
if (extensions & SIMDUTF_RISCV_HWPROBE_IMA_V)
|
||||
host_isa |= instruction_set::RVV;
|
||||
if (extensions & SIMDUTF_RISCV_HWPROBE_EXT_ZVBB)
|
||||
host_isa |= instruction_set::ZVBB;
|
||||
}
|
||||
#endif
|
||||
return host_isa;
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
|
||||
static inline uint32_t detect_supported_architectures() {
|
||||
@@ -2222,6 +2285,63 @@ simdutf_warn_unused size_t trim_partial_utf16le(const char16_t* input, size_t le
|
||||
*/
|
||||
simdutf_warn_unused size_t trim_partial_utf16(const char16_t* input, size_t length);
|
||||
|
||||
|
||||
/**
|
||||
* Provide the maximal binary length in bytes given the base64 input.
|
||||
* In general, if the input contains ASCII spaces, the result will be less than
|
||||
* the maximum length.
|
||||
*
|
||||
* @param input the base64 input to process
|
||||
* @param length the length of the base64 input in bytes
|
||||
* @return number of base64 bytes
|
||||
*/
|
||||
simdutf_warn_unused size_t maximal_binary_length_from_base64(const char * input, size_t length) noexcept;
|
||||
|
||||
/**
|
||||
* Convert a base64 input to a binary ouput.
|
||||
*
|
||||
* This function follows the WHATWG forgiving-base64 format, which means that it will
|
||||
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
|
||||
* equal signs at the end) or an unpadded input (without any equal signs at the end).
|
||||
*
|
||||
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
|
||||
*
|
||||
* This function will fail in case of invalid input. There are two possible reasons for
|
||||
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
|
||||
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
|
||||
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
|
||||
*
|
||||
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
|
||||
* If you fail to provide that much space, the function may cause a buffer overflow.
|
||||
*
|
||||
* @param input the base64 string to process
|
||||
* @param length the length of the string in bytes
|
||||
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
|
||||
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
|
||||
*/
|
||||
simdutf_warn_unused result base64_to_binary(const char * input, size_t length, char* output) noexcept;
|
||||
|
||||
/**
|
||||
* Provide the base64 length in bytes given the length of a binary input.
|
||||
*
|
||||
* @param length the length of the input in bytes
|
||||
* @return number of base64 bytes
|
||||
*/
|
||||
simdutf_warn_unused size_t base64_length_from_binary(size_t length) noexcept;
|
||||
|
||||
/**
|
||||
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
|
||||
* a multiple of 4 bytes long.
|
||||
*
|
||||
* This function always succeeds.
|
||||
*
|
||||
* @param input the binary to process
|
||||
* @param length the length of the input in bytes
|
||||
* @param output the pointer to buffer that can hold the conversion result (should be at least base64_length_from_binary(length) bytes long)
|
||||
* @return number of written bytes, will be equal to base64_length_from_binary(length)
|
||||
*/
|
||||
size_t binary_to_base64(const char * input, size_t length, char* output) noexcept;
|
||||
|
||||
/**
|
||||
* An implementation of simdutf for a particular CPU architecture.
|
||||
*
|
||||
@@ -3282,6 +3402,61 @@ public:
|
||||
*/
|
||||
simdutf_warn_unused virtual size_t count_utf8(const char * input, size_t length) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Provide the maximal binary length in bytes given the base64 input.
|
||||
* In general, if the input contains ASCII spaces, the result will be less than
|
||||
* the maximum length.
|
||||
*
|
||||
* @param input the base64 input to process
|
||||
* @param length the length of the base64 input in bytes
|
||||
* @return number of base64 bytes
|
||||
*/
|
||||
simdutf_warn_unused virtual size_t maximal_binary_length_from_base64(const char * input, size_t length) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Convert a base64 input to a binary ouput.
|
||||
*
|
||||
* This function follows the WHATWG forgiving-base64 format, which means that it will
|
||||
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
|
||||
* equal signs at the end) or an unpadded input (without any equal signs at the end).
|
||||
*
|
||||
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
|
||||
*
|
||||
* This function will fail in case of invalid input. There are two possible reasons for
|
||||
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
|
||||
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
|
||||
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
|
||||
*
|
||||
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
|
||||
* If you fail to provide that much space, the function may cause a buffer overflow.
|
||||
*
|
||||
* @param input the base64 string to process
|
||||
* @param length the length of the string in bytes
|
||||
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
|
||||
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
|
||||
*/
|
||||
simdutf_warn_unused virtual result base64_to_binary(const char * input, size_t length, char* output) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Provide the base64 length in bytes given the length of a binary input.
|
||||
*
|
||||
* @param length the length of the input in bytes
|
||||
* @return number of base64 bytes
|
||||
*/
|
||||
simdutf_warn_unused virtual size_t base64_length_from_binary(size_t length) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
|
||||
* a multiple of 4 bytes long.
|
||||
*
|
||||
* This function always succeeds.
|
||||
*
|
||||
* @param input the binary to process
|
||||
* @param length the length of the input in bytes
|
||||
* @param output the pointer to buffer that can hold the conversion result (should be at least base64_length_from_binary(length) bytes long)
|
||||
* @return number of written bytes, will be equal to base64_length_from_binary(length)
|
||||
*/
|
||||
virtual size_t binary_to_base64(const char * input, size_t length, char* output) const noexcept = 0;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user