Function hamming_rs::distance [−][src]
Expand description
Computes hamming distance
Assumes x and y have same memory alignment
Uses highly optimized avx2 version if available
fallback on distance_faster if x and y have different alignment or if avx2 features are not available
Arguments
x- a byte slice (prefer 32 byte alignment to get highest performance)y- same
Examples
use hamming_rs::distance;
let x: [u8] = [0, 1, 2, 3, 4];
let y: [u8] = [0, 1, 3, 2, 4];
let dist = distance(x, y);
assert_eq!(2, dist);