Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfa8f99d

Browse files
nodejs-github-botmarco-ippolito
authored andcommitted
deps: update simdutf to 5.3.0
PR-URL:#53837Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent642d5c5 commitfa8f99d

File tree

2 files changed

+88
-44
lines changed

2 files changed

+88
-44
lines changed

‎deps/simdutf/simdutf.cpp

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-05-07 22:33:11 -0400. Do not edit! */
1+
/* auto-generated on 2024-07-11 00:01:58 -0400. Do not edit! */
22
/* begin file src/simdutf.cpp */
33
#include "simdutf.h"
44
// We include base64_tables once.
@@ -1522,10 +1522,10 @@ template<>
15221522
struct simd16<bool>: base16<bool> {
15231523
static simdutf_really_inline simd16<bool> splat(bool _value) { return vmovq_n_u16(uint16_t(-(!!_value))); }
15241524

1525-
simdutf_really_inline simd16<bool>() : base16() {}
1526-
simdutf_really_inline simd16<bool>(const uint16x8_t _value) : base16<bool>(_value) {}
1525+
simdutf_really_inline simd16() : base16() {}
1526+
simdutf_really_inline simd16(const uint16x8_t _value) : base16<bool>(_value) {}
15271527
// Splat constructor
1528-
simdutf_really_inline simd16<bool>(bool _value) : base16<bool>(splat(_value)) {}
1528+
simdutf_really_inline simd16(bool _value) : base16<bool>(splat(_value)) {}
15291529

15301530
};
15311531

@@ -2832,10 +2832,10 @@ template<>
28322832
struct simd16<bool>: base16<bool> {
28332833
static simdutf_really_inline simd16<bool> splat(bool _value) { return _mm256_set1_epi16(uint16_t(-(!!_value))); }
28342834

2835-
simdutf_really_inline simd16<bool>() : base16() {}
2836-
simdutf_really_inline simd16<bool>(const __m256i _value) : base16<bool>(_value) {}
2835+
simdutf_really_inline simd16() : base16() {}
2836+
simdutf_really_inline simd16(const __m256i _value) : base16<bool>(_value) {}
28372837
// Splat constructor
2838-
simdutf_really_inline simd16<bool>(bool _value) : base16<bool>(splat(_value)) {}
2838+
simdutf_really_inline simd16(bool _value) : base16<bool>(splat(_value)) {}
28392839

28402840
simdutf_really_inline bitmask_type to_bitmask() const { return _mm256_movemask_epi8(*this); }
28412841
simdutf_really_inline bool any() const { return !_mm256_testz_si256(*this, *this); }
@@ -3803,10 +3803,10 @@ template<>
38033803
struct simd16<bool>: base16<bool> {
38043804
static simdutf_really_inline simd16<bool> splat(bool _value) { return _mm_set1_epi16(uint16_t(-(!!_value))); }
38053805

3806-
simdutf_really_inline simd16<bool>() : base16() {}
3807-
simdutf_really_inline simd16<bool>(const __m128i _value) : base16<bool>(_value) {}
3806+
simdutf_really_inline simd16() : base16() {}
3807+
simdutf_really_inline simd16(const __m128i _value) : base16<bool>(_value) {}
38083808
// Splat constructor
3809-
simdutf_really_inline simd16<bool>(bool _value) : base16<bool>(splat(_value)) {}
3809+
simdutf_really_inline simd16(bool _value) : base16<bool>(splat(_value)) {}
38103810

38113811
simdutf_really_inline int to_bitmask() const { return _mm_movemask_epi8(*this); }
38123812
simdutf_really_inline bool any() const { return !_mm_testz_si128(*this, *this); }
@@ -5807,6 +5807,13 @@ result base64_tail_decode_safe(char *dst, size_t& outlen, const char_type *src,
58075807
// Returns the number of bytes written. The destination buffer must be large
58085808
// enough. It will add padding (=) if needed.
58095809
size_t tail_encode_base64(char *dst, const char *src, size_t srclen, base64_options options) {
5810+
// By default, we use padding if we are not using the URL variant.
5811+
// This is check with ((options & base64_url) == 0) which returns true if we are not using the URL variant.
5812+
// However, we also allow 'inversion' of the convention with the base64_reverse_padding option.
5813+
// If the base64_reverse_padding option is set, we use padding if we are using the URL variant,
5814+
// and we omit it if we are not using the URL variant. This is checked with
5815+
// ((options & base64_reverse_padding) == base64_reverse_padding).
5816+
bool use_padding = ((options & base64_url) == 0) ^ ((options & base64_reverse_padding) == base64_reverse_padding);
58105817
// This looks like 3 branches, but we expect the compiler to resolve this to a single branch:
58115818
const char *e0 = (options & base64_url) ? tables::base64::base64_url::e0 : tables::base64::base64_default::e0;
58125819
const char *e1 = (options & base64_url) ? tables::base64::base64_url::e1 : tables::base64::base64_default::e1;
@@ -5830,7 +5837,7 @@ size_t tail_encode_base64(char *dst, const char *src, size_t srclen, base64_opti
58305837
t1 = uint8_t(src[i]);
58315838
*out++ = e0[t1];
58325839
*out++ = e1[(t1 & 0x03) << 4];
5833-
if((options & base64_url) == 0) {
5840+
if(use_padding) {
58345841
*out++ = '=';
58355842
*out++ = '=';
58365843
}
@@ -5841,7 +5848,7 @@ size_t tail_encode_base64(char *dst, const char *src, size_t srclen, base64_opti
58415848
*out++ = e0[t1];
58425849
*out++ = e1[((t1 & 0x03) << 4) | ((t2 >> 4) & 0x0F)];
58435850
*out++ = e2[(t2 & 0x0F) << 2];
5844-
if((options & base64_url) == 0) {
5851+
if(use_padding) {
58455852
*out++ = '=';
58465853
}
58475854
}
@@ -5869,7 +5876,14 @@ simdutf_warn_unused size_t maximal_binary_length_from_base64(const char_type * i
58695876
}
58705877

58715878
simdutf_warn_unused size_t base64_length_from_binary(size_t length, base64_options options) noexcept {
5872-
if(options & base64_url) {
5879+
// By default, we use padding if we are not using the URL variant.
5880+
// This is check with ((options & base64_url) == 0) which returns true if we are not using the URL variant.
5881+
// However, we also allow 'inversion' of the convention with the base64_reverse_padding option.
5882+
// If the base64_reverse_padding option is set, we use padding if we are using the URL variant,
5883+
// and we omit it if we are not using the URL variant. This is checked with
5884+
// ((options & base64_reverse_padding) == base64_reverse_padding).
5885+
bool use_padding = ((options & base64_url) == 0) ^ ((options & base64_reverse_padding) == base64_reverse_padding);
5886+
if(!use_padding) {
58735887
return length/3 * 4 + ((length % 3) ? (length % 3) + 1 : 0);
58745888
}
58755889
return (length + 2)/3 * 4; // We use padding to make the length a multiple of 4.
@@ -17055,8 +17069,6 @@ result compress_decode_base64(char *dst, const char_type *src, size_t srclen,
1705517069
// can avoid the call to compress_block and decode directly.
1705617070
copy_block(&b, bufferptr);
1705717071
bufferptr += 64;
17058-
// base64_decode_block(dst, &b);
17059-
// dst += 48;
1706017072
}
1706117073
if (bufferptr >= (block_size - 1) * 64 + buffer) {
1706217074
for (size_t i = 0; i < (block_size - 1); i++) {
@@ -27138,8 +27150,8 @@ simdutf_really_inline __m256i lookup_pshufb_improved(const __m256i input) {
2713827150
return _mm256_add_epi8(result, input);
2713927151
}
2714027152

27141-
template <base64_options options>
27142-
size_t encode_base64(char *dst, const char *src, size_t srclen) {
27153+
template <bool isbase64url>
27154+
size_t encode_base64(char *dst, const char *src, size_t srclen, base64_options options) {
2714327155
// credit: Wojciech Muła
2714427156
const uint8_t *input = (const uint8_t *)src;
2714527157

@@ -27206,18 +27218,18 @@ size_t encode_base64(char *dst, const char *src, size_t srclen) {
2720627218
const __m256i input3 = _mm256_or_si256(t1_3, t3_3);
2720727219

2720827220
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out),
27209-
lookup_pshufb_improved<options == base64_url>(input0));
27221+
lookup_pshufb_improved<isbase64url>(input0));
2721027222
out += 32;
2721127223

2721227224
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out),
27213-
lookup_pshufb_improved<options == base64_url>(input1));
27225+
lookup_pshufb_improved<isbase64url>(input1));
2721427226
out += 32;
2721527227

2721627228
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out),
27217-
lookup_pshufb_improved<options == base64_url>(input2));
27229+
lookup_pshufb_improved<isbase64url>(input2));
2721827230
out += 32;
2721927231
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out),
27220-
lookup_pshufb_improved<options == base64_url>(input3));
27232+
lookup_pshufb_improved<isbase64url>(input3));
2722127233
out += 32;
2722227234
}
2722327235
for (; i + 28 <= srclen; i += 24) {
@@ -27241,7 +27253,7 @@ size_t encode_base64(char *dst, const char *src, size_t srclen) {
2724127253
const __m256i indices = _mm256_or_si256(t1, t3);
2724227254

2724327255
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out),
27244-
lookup_pshufb_improved<options == base64_url>(indices));
27256+
lookup_pshufb_improved<isbase64url>(indices));
2724527257
out += 32;
2724627258
}
2724727259
return i / 3 * 4 + scalar::base64::tail_encode_base64((char *)out, src + i,
@@ -30012,9 +30024,9 @@ simdutf_warn_unused size_t implementation::base64_length_from_binary(size_t leng
3001230024

3001330025
size_t implementation::binary_to_base64(const char * input, size_t length, char* output, base64_options options) const noexcept {
3001430026
if(options & base64_url) {
30015-
return encode_base64<base64_url>(output, input, length);
30027+
return encode_base64<true>(output, input, length, options);
3001630028
} else {
30017-
return encode_base64<base64_default>(output, input, length);
30029+
return encode_base64<false>(output, input, length, options);
3001830030
}
3001930031
}
3002030032
} // namespace haswell
@@ -35675,8 +35687,8 @@ template <bool base64_url> __m128i lookup_pshufb_improved(const __m128i input) {
3567535687
return _mm_add_epi8(result, input);
3567635688
}
3567735689

35678-
template <base64_options options>
35679-
size_t encode_base64(char *dst, const char *src, size_t srclen) {
35690+
template <bool isbase64url>
35691+
size_t encode_base64(char *dst, const char *src, size_t srclen, base64_options options) {
3568035692
// credit: Wojciech Muła
3568135693
// SSE (lookup: pshufb improved unrolled)
3568235694
const uint8_t *input = (const uint8_t *)src;
@@ -35727,19 +35739,19 @@ size_t encode_base64(char *dst, const char *src, size_t srclen) {
3572735739
const __m128i input3 = _mm_or_si128(t1_3, t3_3);
3572835740

3572935741
_mm_storeu_si128(reinterpret_cast<__m128i *>(out),
35730-
lookup_pshufb_improved<options & base64_url>(input0));
35742+
lookup_pshufb_improved<isbase64url>(input0));
3573135743
out += 16;
3573235744

3573335745
_mm_storeu_si128(reinterpret_cast<__m128i *>(out),
35734-
lookup_pshufb_improved<options & base64_url>(input1));
35746+
lookup_pshufb_improved<isbase64url>(input1));
3573535747
out += 16;
3573635748

3573735749
_mm_storeu_si128(reinterpret_cast<__m128i *>(out),
35738-
lookup_pshufb_improved<options & base64_url>(input2));
35750+
lookup_pshufb_improved<isbase64url>(input2));
3573935751
out += 16;
3574035752

3574135753
_mm_storeu_si128(reinterpret_cast<__m128i *>(out),
35742-
lookup_pshufb_improved<options & base64_url>(input3));
35754+
lookup_pshufb_improved<isbase64url>(input3));
3574335755
out += 16;
3574435756
}
3574535757
for (; i + 16 <= srclen; i += 12) {
@@ -35779,7 +35791,7 @@ size_t encode_base64(char *dst, const char *src, size_t srclen) {
3577935791
const __m128i indices = _mm_or_si128(t1, t3);
3578035792

3578135793
_mm_storeu_si128(reinterpret_cast<__m128i *>(out),
35782-
lookup_pshufb_improved<options & base64_url>(indices));
35794+
lookup_pshufb_improved<isbase64url>(indices));
3578335795
out += 16;
3578435796
}
3578535797

@@ -38555,10 +38567,10 @@ simdutf_warn_unused size_t implementation::base64_length_from_binary(size_t leng
3855538567
}
3855638568

3855738569
size_t implementation::binary_to_base64(const char * input, size_t length, char* output, base64_options options) const noexcept {
38558-
if(options== base64_url) {
38559-
return encode_base64<base64_url>(output, input, length);
38570+
if(options& base64_url) {
38571+
return encode_base64<true>(output, input, length, options);
3856038572
} else {
38561-
return encode_base64<base64_default>(output, input, length);
38573+
return encode_base64<false>(output, input, length, options);
3856238574
}
3856338575
}
3856438576
} // namespace westmere

‎deps/simdutf/simdutf.h

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-05-07 22:33:11 -0400. Do not edit!*/
1+
/* auto-generated on 2024-07-11 00:01:58 -0400. Do not edit!*/
22
/* begin file include/simdutf.h*/
33
#ifndef SIMDUTF_H
44
#defineSIMDUTF_H
@@ -594,7 +594,7 @@ SIMDUTF_DISABLE_UNDESIRED_WARNINGS
594594
#defineSIMDUTF_SIMDUTF_VERSION_H
595595

596596
/** The version of simdutf being used (major.minor.revision)*/
597-
#defineSIMDUTF_VERSION"5.2.8"
597+
#defineSIMDUTF_VERSION"5.3.0"
598598

599599
namespacesimdutf {
600600
enum {
@@ -605,11 +605,11 @@ enum {
605605
/**
606606
* The minor version (major.MINOR.revision) of simdutf being used.
607607
*/
608-
SIMDUTF_VERSION_MINOR =2,
608+
SIMDUTF_VERSION_MINOR =3,
609609
/**
610610
* The revision (major.minor.REVISION) of simdutf being used.
611611
*/
612-
SIMDUTF_VERSION_REVISION =8
612+
SIMDUTF_VERSION_REVISION =0
613613
};
614614
}// namespace simdutf
615615

@@ -2300,9 +2300,13 @@ simdutf_warn_unused size_t trim_partial_utf16(const char16_t* input, size_t leng
23002300

23012301
// base64_options are used to specify the base64 encoding options.
23022302
using base64_options =uint64_t;
2303+
using base64_options =uint64_t;
23032304
enum : base64_options {
2304-
base64_default =0,/* standard base64 format*/
2305-
base64_url =1/* base64url format*/
2305+
base64_default =0,/* standard base64 format (with padding)*/
2306+
base64_url =1,/* base64url format (no padding)*/
2307+
base64_reverse_padding =2,/* modifier for base64_default and base64_url*/
2308+
base64_default_no_padding = base64_default | base64_reverse_padding,/* standard base64 format without padding*/
2309+
base64_url_with_padding = base64_url | base64_reverse_padding,/* base64url with padding*/
23062310
};
23072311

23082312
/**
@@ -2345,6 +2349,12 @@ simdutf_warn_unused size_t maximal_binary_length_from_base64(const char16_t * in
23452349
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
23462350
* r.count contains the number of bytes decoded.
23472351
*
2352+
* The default option (simdutf::base64_default) expects the characters `+` and `/` as part of its alphabet.
2353+
* The URL option (simdutf::base64_url) expects the characters `-` and `_` as part of its alphabet.
2354+
*
2355+
* The padding (`=`) is validated if present. There may be at most two padding characters at the end of the input.
2356+
* If there are any padding characters, the total number of characters (excluding spaces but including padding characters) must be divisible by four.
2357+
*
23482358
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
23492359
* If you fail to provide that much space, the function may cause a buffer overflow.
23502360
*
@@ -2365,8 +2375,13 @@ simdutf_warn_unused result base64_to_binary(const char * input, size_t length, c
23652375
simdutf_warn_unusedsize_tbase64_length_from_binary(size_t length, base64_options options = base64_default)noexcept;
23662376

23672377
/**
2368-
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
2369-
* a multiple of 4 bytes long.
2378+
* Convert a binary input to a base64 ouput.
2379+
*
2380+
* The default option (simdutf::base64_default) uses the characters `+` and `/` as part of its alphabet.
2381+
* Further, it adds padding (`=`) at the end of the output to ensure that the output length is a multiple of four.
2382+
*
2383+
* The URL option (simdutf::base64_url) uses the characters `-` and `_` as part of its alphabet. No padding
2384+
* is added at the end of the output.
23702385
*
23712386
* This function always succeeds.
23722387
*
@@ -2396,6 +2411,12 @@ size_t binary_to_base64(const char * input, size_t length, char* output, base64_
23962411
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
23972412
* r.count contains the number of bytes decoded.
23982413
*
2414+
* The default option (simdutf::base64_default) expects the characters `+` and `/` as part of its alphabet.
2415+
* The URL option (simdutf::base64_url) expects the characters `-` and `_` as part of its alphabet.
2416+
*
2417+
* The padding (`=`) is validated if present. There may be at most two padding characters at the end of the input.
2418+
* If there are any padding characters, the total number of characters (excluding spaces but including padding characters) must be divisible by four.
2419+
*
23992420
* You should call this function with a buffer that is at least maximal_binary_length_from_utf6_base64(input, length) bytes long.
24002421
* If you fail to provide that much space, the function may cause a buffer overflow.
24012422
*
@@ -2429,6 +2450,12 @@ simdutf_warn_unused result base64_to_binary(const char16_t * input, size_t lengt
24292450
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
24302451
* r.count contains the number of bytes decoded.
24312452
*
2453+
* The default option (simdutf::base64_default) expects the characters `+` and `/` as part of its alphabet.
2454+
* The URL option (simdutf::base64_url) expects the characters `-` and `_` as part of its alphabet.
2455+
*
2456+
* The padding (`=`) is validated if present. There may be at most two padding characters at the end of the input.
2457+
* If there are any padding characters, the total number of characters (excluding spaces but including padding characters) must be divisible by four.
2458+
*
24322459
* The INVALID_BASE64_CHARACTER cases are considered fatal and you are expected to discard
24332460
* the output.
24342461
*
@@ -3590,8 +3617,13 @@ class implementation {
35903617
simdutf_warn_unusedvirtualsize_tbase64_length_from_binary(size_t length, base64_options options = base64_default)constnoexcept = 0;
35913618

35923619
/**
3593-
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
3594-
* a multiple of 4 bytes long.
3620+
* Convert a binary input to a base64 ouput.
3621+
*
3622+
* The default option (simdutf::base64_default) uses the characters `+` and `/` as part of its alphabet.
3623+
* Further, it adds padding (`=`) at the end of the output to ensure that the output length is a multiple of four.
3624+
*
3625+
* The URL option (simdutf::base64_url) uses the characters `-` and `_` as part of its alphabet. No padding
3626+
* is added at the end of the output.
35953627
*
35963628
* This function always succeeds.
35973629
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp