| 310 | } |
| 311 | |
| 312 | bool are_all_bytes_zero(int64_t hardware_flags, const uint8_t* bytes, |
| 313 | uint32_t num_bytes) { |
| 314 | #if defined(ARROW_HAVE_RUNTIME_AVX2) && defined(ARROW_HAVE_RUNTIME_BMI2) |
| 315 | if ((hardware_flags & CpuInfo::AVX2) && CpuInfo::GetInstance()->HasEfficientBmi2()) { |
| 316 | return avx2::are_all_bytes_zero_avx2(bytes, num_bytes); |
| 317 | } |
| 318 | #endif |
| 319 | uint64_t result_or = 0; |
| 320 | uint32_t i; |
| 321 | for (i = 0; i < num_bytes / 8; ++i) { |
| 322 | uint64_t x = util::SafeLoad(&reinterpret_cast<const uint64_t*>(bytes)[i]); |
| 323 | result_or |= x; |
| 324 | } |
| 325 | if (num_bytes % 8 > 0) { |
| 326 | uint64_t tail = 0; |
| 327 | result_or |= memcmp(bytes + i * 8, &tail, num_bytes % 8); |
| 328 | } |
| 329 | return result_or == 0; |
| 330 | } |
| 331 | |
| 332 | } // namespace bit_util |
| 333 | } // namespace util |
no test coverage detected