From 0942c802725b4c2816f2232304cdd14b3e44cd3f Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 5 Mar 2013 20:54:19 -0800 Subject: [PATCH] core: fix trie chunk function --- src/libcore/trie.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/trie.rs b/src/libcore/trie.rs index d6dcad33408..cf34ba774a8 100644 --- a/src/libcore/trie.rs +++ b/src/libcore/trie.rs @@ -272,8 +272,8 @@ impl TrieNode { // 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(count: &mut uint, child: &mut Child, key: uint, value: T,