[−][src]Function triple_accel::hamming::hamming
pub fn hamming(a: &[u8], b: &[u8]) -> u32
Returns the hamming distance between two strings using the best method.
The length of a
and b
must be the same.
This will automatically fall back to a scalar alternative if AVX2 and
SSE4.1 are not supported.
Internally, this calls hamming_simd_parallel
.
Arguments
a
- first string (slice)b
- second string (slice)
Panics
- If the length of
a
does not equal the length ofb
.
Example
let dist = hamming(b"abc", b"abd"); assert!(dist == 1);