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

Function are_all_bytes_zero

cpp/src/arrow/compute/util.cc:312–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312bool 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

Callers 1

has_any_nullsMethod · 0.85

Calls 2

are_all_bytes_zero_avx2Function · 0.85
SafeLoadFunction · 0.85

Tested by

no test coverage detected