Skip to content

Commit 0942c80

Browse files
graydonthestinger
authored andcommitted
core: fix trie chunk function
1 parent 98900d5 commit 0942c80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/trie.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ impl<T> TrieNode<T> {
272272
// if this was done via a trait, the key could be generic
273273
#[inline(always)]
274274
pure fn chunk(n: uint, idx: uint) -> uint {
275-
let real_idx = uint::bytes - 1 - idx;
276-
(n >> (SHIFT * real_idx)) & MASK
275+
let sh = uint::bits - (SHIFT * (idx + 1));
276+
(n >> sh) & MASK
277277
}
278278

279279
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,

0 commit comments

Comments
 (0)