core: fix trie chunk function

This commit is contained in:
Graydon Hoare 2013-03-05 20:54:19 -08:00 committed by Daniel Micay
parent 98900d55e7
commit 0942c80272

View File

@ -272,8 +272,8 @@ fn mutate_values(&mut self, f: &fn(&uint, &mut T) -> bool) -> bool {
// if this was done via a trait, the key could be generic
#[inline(always)]
pure fn chunk(n: uint, idx: uint) -> uint {
let real_idx = uint::bytes - 1 - idx;
(n >> (SHIFT * real_idx)) & MASK
let sh = uint::bits - (SHIFT * (idx + 1));
(n >> sh) & MASK
}
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,