# Crate hamming [−] [src]

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);

## Functions

distance | Computes the bitwise Hamming distance between `x` and `y`, that is, the number of bits where `x` and `y` differ, or, the number of set bits in the xor of `x` and `y`.
distance_fast | Computes the bitwise Hamming distance between `x` and `y`, that is, the number of bits where `x` and `y` differ, or, the number of set bits in the xor of `x` and `y`.
weight | Computes the Hamming weight of `x`, that is, the population count, or number of ones.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)