Skip to content

Instantly share code, notes, and snippets.

@codahale
Created February 22, 2015 20:39
Show Gist options
  • Save codahale/12d39714a6723289dc9f to your computer and use it in GitHub Desktop.
Save codahale/12d39714a6723289dc9f to your computer and use it in GitHub Desktop.
pub fn estimate(&self, e: &E) -> u64 {
indexes(e, self.width)
.take(self.depth)
.enumerate()
.map(|(i, idx)| self.counters[i][idx])
.min()
.unwrap()
}
pub fn estimate(&self, e: E) -> C {
let (h1, h2) = hashes(e);
let mut max: C = Int::zero();
for (i, c) in self.counters.iter().enumerate() {
let idx = index(h1, h2, i, c.len());
let v = c[idx];
if v > max {
max = v
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment