MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / sz_equal_neon

Function sz_equal_neon

include/stringzilla/compare.h:446–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446SZ_PUBLIC sz_bool_t sz_equal_neon(sz_cptr_t a, sz_cptr_t b, sz_size_t length) {
447 if (length < 16) return sz_equal_serial(a, b, length);
448
449 sz_u128_vec_t a_vec, b_vec;
450 sz_size_t offset = 0;
451 do {
452 a_vec.u8x16 = vld1q_u8((sz_u8_t const *)(a + offset));
453 b_vec.u8x16 = vld1q_u8((sz_u8_t const *)(b + offset));
454 uint8x16_t cmp = vceqq_u8(a_vec.u8x16, b_vec.u8x16);
455 if (vminvq_u8(cmp) != 255) return sz_false_k; // Check if all bytes match
456 offset += 16;
457 } while (offset + 16 <= length);
458
459 // For final check - load the last register-long piece of content from the end
460 a_vec.u8x16 = vld1q_u8((sz_u8_t const *)(a + length - 16));
461 b_vec.u8x16 = vld1q_u8((sz_u8_t const *)(b + length - 16));
462 uint8x16_t cmp = vceqq_u8(a_vec.u8x16, b_vec.u8x16);
463 if (vminvq_u8(cmp) != 255) return sz_false_k;
464 return sz_true_k;
465}
466
467#if defined(__clang__)
468#pragma clang attribute pop

Callers 3

sz_equalFunction · 0.85
sz_find_neonFunction · 0.85
sz_rfind_neonFunction · 0.85

Calls 1

sz_equal_serialFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…