Skip to content

Commit

Permalink
Add docs for PhfHash
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Aug 9, 2014
1 parent b2220d9 commit 341d836
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shared/mod.rs
Expand Up @@ -12,12 +12,14 @@ pub fn displace(f1: u32, f2: u32, d1: u32, d2: u32) -> u32 {
fn split(hash: u64) -> (u32, u32, u32) {
let mask = (MAX_SIZE - 1) as u64;

((hash & mask) as u32,
((hash & mask) as u32,
((hash >> LOG_MAX_SIZE) & mask) as u32,
((hash >> (2 * LOG_MAX_SIZE)) & mask) as u32)
}

/// A trait implemented by types which can be used in PHF data structures
pub trait PhfHash {
/// Hashes the value of `self`, factoring in a seed
fn phf_hash(&self, seed: u64) -> (u32, u32, u32);
}

Expand Down

0 comments on commit 341d836

Please sign in to comment.