Function triple_accel::hamming::hamming_simd_parallel[][src]

pub fn hamming_simd_parallel(a: &[u8], b: &[u8]) -> u32
Expand description

Returns the hamming distance between two strings by counting mismatches using SIMD vectors to increment multiple counters in parallel.

The length of a and b must be the same. There are no constraints on how a and b are aligned and padded. This will automatically fall back to hamming_naive, if AVX2 and SSE4.1 are not supported. This should be faster than both hamming_word_64/128 and hamming_simd_movemask.

Arguments

  • a - first string (slice)
  • b - second string (slice)

Panics

  • If the length of a does not equal the length of b.

Example

let dist = hamming_simd_parallel(b"abc", b"abd");

assert!(dist == 1);