Expand description
Shared SIMD Hamming-distance kernel with runtime CPU-feature dispatch.
Used by 1-bit quantizers (bbq, rabitq)
and any future binary code that needs to count differing bits between
two equal-length packed-bit slices.
Dispatch order (resolved once via OnceLock):
x86_64+avx512f+avx512vpopcntdq→ AVX-512 VPOPCNTDQ kernelx86_64+avx2→ 64-bit popcnt unrolled 4×aarch64→ NEONvcntq_u8- fallback → scalar 8-byte popcnt
Functions§
- hamming_
distance - Count the number of differing bits between two equal-length packed-bit slices, dispatching to the best available SIMD kernel at runtime.