@@ -153,27 +153,27 @@ uint64_t to_base64_mask(block64 *b, bool *error) {
153153#ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
154154 if (default_or_url) {
155155 lut_lo =
156- simdutf_make_uint8x16_t (0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
157- 0x1c , 0x1d , 0x19 , 0x12 , 0x11 , 0x13 , 0x10 , 0x32 );
156+ simdutf_make_uint8x16_t (0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
157+ 0xf8 , 0xf9 , 0xf1 , 0xa2 , 0xa1 , 0xa5 , 0xa0 , 0xa6 );
158158 } else if (base64_url) {
159159 lut_lo =
160- simdutf_make_uint8x16_t (0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
161- 0x1c , 0x1d , 0x19 , 0x10 , 0x11 , 0x13 , 0x10 , 0x30 );
160+ simdutf_make_uint8x16_t (0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
161+ 0xf8 , 0xf9 , 0xf1 , 0xa0 , 0xa1 , 0xa5 , 0xa0 , 0xa2 );
162162 } else {
163163 lut_lo =
164- simdutf_make_uint8x16_t (0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
165- 0x1c , 0x1d , 0x19 , 0x12 , 0x11 , 0x11 , 0x10 , 0x12 );
164+ simdutf_make_uint8x16_t (0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
165+ 0xf8 , 0xf9 , 0xf1 , 0xa2 , 0xa1 , 0xa1 , 0xa0 , 0xa4 );
166166 }
167167#else
168168 if (default_or_url) {
169- lut_lo = uint8x16_t {0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
170- 0x1c , 0x1d , 0x19 , 0x12 , 0x11 , 0x13 , 0x10 , 0x32 };
169+ lut_lo = uint8x16_t {0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
170+ 0xf8 , 0xf9 , 0xf1 , 0xa2 , 0xa1 , 0xa5 , 0xa0 , 0xa6 };
171171 } else if (base64_url) {
172- lut_lo = uint8x16_t {0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
173- 0x1c , 0x1d , 0x19 , 0x10 , 0x11 , 0x13 , 0x10 , 0x30 };
172+ lut_lo = uint8x16_t {0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
173+ 0xf8 , 0xf9 , 0xf1 , 0xa0 , 0xa1 , 0xa5 , 0xa0 , 0xa2 };
174174 } else {
175- lut_lo = uint8x16_t {0x15 , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c , 0x1c ,
176- 0x1c , 0x1d , 0x19 , 0x12 , 0x11 , 0x11 , 0x10 , 0x12 };
175+ lut_lo = uint8x16_t {0xa9 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 , 0xf8 ,
176+ 0xf8 , 0xf9 , 0xf1 , 0xa2 , 0xa1 , 0xa1 , 0xa0 , 0xa4 };
177177 }
178178#endif
179179 uint8x16_t lo0 = vqtbl1q_u8 (lut_lo, lo_nibbles0);
@@ -184,27 +184,27 @@ uint64_t to_base64_mask(block64 *b, bool *error) {
184184#ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
185185 if (default_or_url) {
186186 lut_hi =
187- simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 , 0x8 ,
188- 0x10 , 0x10 , 0x28 , 0x8 , 0x10 , 0x10 , 0x8 );
187+ simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x6 , 0x8 , 0x8 , 0x10 ,
188+ 0x20 , 0x20 , 0x12 , 0x40 , 0x80 , 0x80 , 0x40 );
189189 } else if (base64_url) {
190190 lut_hi =
191- simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 , 0x8 ,
192- 0x10 , 0x10 , 0x28 , 0x8 , 0x10 , 0x10 , 0x8 );
191+ simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x6 , 0x8 , 0x8 , 0x10 ,
192+ 0x20 , 0x20 , 0x12 , 0x40 , 0x80 , 0x80 , 0x40 );
193193 } else {
194194 lut_hi =
195- simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 , 0x8 ,
196- 0x10 , 0x10 , 0x8 , 0x8 , 0x10 , 0x10 , 0x8 );
195+ simdutf_make_uint8x16_t (0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x6 , 0x8 , 0x8 , 0x10 ,
196+ 0x20 , 0x20 , 0x10 , 0x40 , 0x80 , 0x80 , 0x40 );
197197 }
198198#else
199199 if (default_or_url) {
200- lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 ,
201- 0x8 , 0x10 , 0x10 , 0x28 , 0x8 , 0x10 , 0x10 , 0x8 };
200+ lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x6 , 0x8 , 0x8 ,
201+ 0x10 , 0x20 , 0x20 , 0x12 , 0x40 , 0x80 , 0x80 , 0x40 };
202202 } else if (base64_url) {
203- lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 ,
204- 0x8 , 0x10 , 0x10 , 0x28 , 0x8 , 0x10 , 0x10 , 0x8 };
203+ lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x4 , 0x8 , 0x8 ,
204+ 0x10 , 0x20 , 0x20 , 0x12 , 0x40 , 0x80 , 0x80 , 0x40 };
205205 } else {
206- lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x2 , 0x4 , 0x4 ,
207- 0x8 , 0x10 , 0x10 , 0x8 , 0x8 , 0x10 , 0x10 , 0x8 };
206+ lut_hi = uint8x16_t {0x0 , 0x1 , 0x0 , 0x0 , 0x1 , 0x6 , 0x8 , 0x8 ,
207+ 0x10 , 0x20 , 0x20 , 0x10 , 0x40 , 0x80 , 0x80 , 0x40 };
208208 }
209209#endif
210210 uint8x16_t hi0 = vqtbl1q_u8 (lut_hi, hi_bits0);
@@ -248,67 +248,62 @@ uint64_t to_base64_mask(block64 *b, bool *error) {
248248 // This is the transformation step that can be done while we are waiting for
249249 // sum0
250250 uint8x16_t roll_lut;
251- uint8x16_t delta_asso;
252251#ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
253252 if (default_or_url) {
254253 roll_lut =
255254 simdutf_make_uint8x16_t (0xBF , 0xE0 , 0xB9 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
256255 0xB9 , 0x00 , 0xFF , 0x11 , 0xFF , 0xBF , 0x10 , 0xB9 );
257256 } else if (base64_url) {
258257 roll_lut =
259- simdutf_make_uint8x16_t (0x00 , 0x00 , 0x00 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
260- 0xB9 , 0x00 , 0x11 , 0xC3 , 0xBF , 0xE0 , 0xB9 , 0xB9 );
258+ simdutf_make_uint8x16_t (0xB9 , 0xB9 , 0xBF , 0xBF , 0x04 , 0x11 , 0xE0 , 0x00 ,
259+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 );
261260 } else {
262261 roll_lut =
263- simdutf_make_uint8x16_t (0x00 , 0x00 , 0x00 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
264- 0xB9 , 0x00 , 0x10 , 0xC3 , 0xBF , 0xBF , 0xB9 , 0xB9 );
265- }
266- if (default_or_url) {
267- delta_asso =
268- simdutf_make_uint8x16_t (0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
269- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x16 );
270- } else {
271- delta_asso =
272- simdutf_make_uint8x16_t (0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
273- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x0F , 0x00 , 0x0F );
262+ simdutf_make_uint8x16_t (0xB9 , 0xB9 , 0xBF , 0xBF , 0x04 , 0x10 , 0x13 , 0x00 ,
263+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 );
274264 }
275265#else
276266 if (default_or_url) {
277267 roll_lut = uint8x16_t {0xBF , 0xE0 , 0xB9 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
278268 0xB9 , 0x00 , 0xFF , 0x11 , 0xFF , 0xBF , 0x10 , 0xB9 };
279269 } else if (base64_url) {
280- roll_lut = uint8x16_t {0x00 , 0x00 , 0x00 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
281- 0xB9 , 0x00 , 0x11 , 0xC3 , 0xBF , 0xE0 , 0xB9 , 0xB9 };
270+ roll_lut = uint8x16_t {0xB9 , 0xB9 , 0xBF , 0xBF , 0x04 , 0x11 , 0xE0 , 0x00 ,
271+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
282272 } else {
283- roll_lut = uint8x16_t {0x00 , 0x00 , 0x00 , 0x13 , 0x04 , 0xBF , 0xBF , 0xB9 ,
284- 0xB9 , 0x00 , 0x10 , 0xC3 , 0xBF , 0xBF , 0xB9 , 0xB9 };
285- }
286- if (default_or_url) {
287- delta_asso = uint8x16_t {0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
288- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x16 };
289- } else {
290- delta_asso = uint8x16_t {0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
291- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x0F , 0x00 , 0x0F };
273+ roll_lut = uint8x16_t {0xB9 , 0xB9 , 0xBF , 0xBF , 0x04 , 0x10 , 0x13 , 0x00 ,
274+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
292275 }
293276#endif
294- // the logic of translating is based on westmere
295- uint8x16_t delta_hash0 =
296- vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles0), hi_bits0);
297- uint8x16_t delta_hash1 =
298- vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles1), hi_bits1);
299- uint8x16_t delta_hash2 =
300- vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles2), hi_bits2);
301- uint8x16_t delta_hash3 =
302- vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles3), hi_bits3);
303-
304277 uint8x16_t roll0, roll1, roll2, roll3;
305278 if (default_or_url) {
279+ #ifdef SIMDUTF_REGULAR_VISUAL_STUDIO
280+ const uint8x16_t delta_asso =
281+ simdutf_make_uint8x16_t (0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
282+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x16 );
283+ #else
284+ const uint8x16_t delta_asso =
285+ uint8x16_t {0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
286+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x16 };
287+ #endif
288+ // the logic of translating is based on westmere
289+ uint8x16_t delta_hash0 =
290+ vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles0), hi_bits0);
291+ uint8x16_t delta_hash1 =
292+ vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles1), hi_bits1);
293+ uint8x16_t delta_hash2 =
294+ vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles2), hi_bits2);
295+ uint8x16_t delta_hash3 =
296+ vrhaddq_u8 (vqtbl1q_u8 (delta_asso, lo_nibbles3), hi_bits3);
306297 const uint8x16x2_t roll_lut_2 = {roll_lut, roll_lut};
307298 roll0 = vqtbl2q_u8 (roll_lut_2, delta_hash0);
308299 roll1 = vqtbl2q_u8 (roll_lut_2, delta_hash1);
309300 roll2 = vqtbl2q_u8 (roll_lut_2, delta_hash2);
310301 roll3 = vqtbl2q_u8 (roll_lut_2, delta_hash3);
311302 } else {
303+ uint8x16_t delta_hash0 = vclzq_u8 (res0);
304+ uint8x16_t delta_hash1 = vclzq_u8 (res1);
305+ uint8x16_t delta_hash2 = vclzq_u8 (res2);
306+ uint8x16_t delta_hash3 = vclzq_u8 (res3);
312307 roll0 = vqtbl1q_u8 (roll_lut, delta_hash0);
313308 roll1 = vqtbl1q_u8 (roll_lut, delta_hash1);
314309 roll2 = vqtbl1q_u8 (roll_lut, delta_hash2);
0 commit comments