4 releases
Uses old Rust 2015
0.1.3 | Jun 1, 2015 |
---|---|
0.1.2 | Jun 1, 2015 |
0.1.1 | May 31, 2015 |
0.1.0 | May 31, 2015 |
#1205 in Algorithms
29,233 downloads per month
Used in 107 crates
(9 directly)
18KB
316 lines
hamming
A crate to compute the Hamming weight of a vector and the Hamming distance between two efficiently.
lib.rs
:
A crate to count ones and xor bytes, fast (aka popcount, hamming weight and hamming distance).
Installation
Add this to your Cargo.toml
:
[dependencies]
hamming = "0.1"
Examples
assert_eq!(hamming::weight(&[1, 0xFF, 1, 0xFF]), 1 + 8 + 1 + 8);
assert_eq!(hamming::distance(&[1, 0xFF], &[0xFF, 1]), 7 + 7);