| 444 | } |
| 445 | |
| 446 | SZ_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 |
no test coverage detected
searching dependent graphs…