about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2013-03-05 20:54:19 -0800
committerDaniel Micay <danielmicay@gmail.com>2013-03-15 21:12:17 -0400
commit0942c802725b4c2816f2232304cdd14b3e44cd3f (patch)
tree7ffb45ee35f0b9df74d7957f10341587cfeca1f9
parent98900d55e7f08a4b4cb665152a01b0bbf655baae (diff)
downloadrust-0942c802725b4c2816f2232304cdd14b3e44cd3f.tar.gz
rust-0942c802725b4c2816f2232304cdd14b3e44cd3f.zip
core: fix trie chunk function
-rw-r--r--src/libcore/trie.rs4
1 files 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<T> TrieNode<T> {
 // 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,