MCPcopy Create free account
hub / github.com/apache/arrow / ValidateAsciiSimd

Function ValidateAsciiSimd

cpp/src/arrow/util/utf8_internal.h:241–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239
240#if defined(ARROW_HAVE_NEON) || defined(ARROW_HAVE_SSE4_2)
241static inline bool ValidateAsciiSimd(const uint8_t* data, int64_t len) {
242 using simd_batch = xsimd::make_sized_batch_t<int8_t, 16>;
243
244 if (len >= 32) {
245 const simd_batch zero(static_cast<int8_t>(0));
246 const uint8_t* data2 = data + 16;
247 simd_batch or1 = zero, or2 = zero;
248
249 while (len >= 32) {
250 or1 |= simd_batch::load_unaligned(reinterpret_cast<const int8_t*>(data));
251 or2 |= simd_batch::load_unaligned(reinterpret_cast<const int8_t*>(data2));
252 data += 32;
253 data2 += 32;
254 len -= 32;
255 }
256
257 // To test for upper bit in all bytes, test whether any of them is negative
258 or1 |= or2;
259 if (xsimd::any(or1 < zero)) {
260 return false;
261 }
262 }
263
264 return ValidateAsciiSw(data, len);
265}
266#endif // ARROW_HAVE_NEON || ARROW_HAVE_SSE4_2
267
268static inline bool ValidateAscii(const uint8_t* data, int64_t len) {

Callers 1

ValidateAsciiFunction · 0.85

Calls 1

ValidateAsciiSwFunction · 0.85

Tested by

no test coverage detected