#[cfg_attr(
all(
feature = "multiversion_x86",
any(target_arch = "x86", target_arch = "x86_64")
),
multiversion::multiversion(targets(
"x86_64+avx512vpopcntdq+avx512vl+popcnt",
"x86_64+avx512bw+avx512vl+popcnt",
"x86_64+avx2+popcnt",
"x86_64+sse4.2+popcnt",
"x86+avx2+popcnt",
"x86+sse4.2+popcnt",
))
)]
#[inline(always)]
pub fn distance(a: &[u8], b: &[u8]) -> u32 {
assert_eq!(a.len(), b.len());
crate::distance_impl(a, b)
}
#[cfg_attr(
all(
feature = "multiversion_x86",
any(target_arch = "x86", target_arch = "x86_64")
),
multiversion::multiversion(targets(
"x86_64+avx512vpopcntdq+avx512vl+popcnt",
"x86_64+avx512bw+avx512vl+popcnt",
"x86_64+avx2+popcnt",
"x86_64+sse4.2+popcnt",
"x86+avx2+popcnt",
"x86+sse4.2+popcnt",
))
)]
#[inline(always)]
pub fn batch(source: &[u8], targets: &[&[u8]], out: &mut [u32]) {
assert_eq!(targets.len(), out.len());
for (target, dist) in targets.iter().zip(out.iter_mut()) {
assert_eq!(source.len(), target.len());
*dist = crate::distance_impl(source, target);
}
}