     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

    //! A crate to count ones and xor bytes, fast (aka popcount, hamming
    //! weight and hamming distance).
    //!
    //! # Installation
    //!
    //! Add this to your `Cargo.toml`:
    //!
    //! ```toml
    //! [dependencies]
    //! hamming = "0.1"
    //! ```
    //!
    //! # Examples
    //!
    //! ```rust
    //! assert_eq!(hamming::weight(&[1, 0xFF, 1, 0xFF]), 1 + 8 + 1 + 8);
    //! assert_eq!(hamming::distance(&[1, 0xFF], &[0xFF, 1]), 7 + 7);
    //! ```

    #![cfg_attr(all(test, feature = "unstable"), feature(test))]
    #[cfg(test)] extern crate quickcheck;
    #[cfg(test)] extern crate rand;
    #[cfg(all(test, feature = "unstable"))] extern crate test;

    mod weight_;
    pub use weight_::weight;

    mod distance_;
    pub use distance_::{distance, distance_fast};

# 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`)