aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-11 16:54:05 -0700
committerPatrick Walton <[email protected]>2011-04-11 16:54:05 -0700
commit9d9790c7f50b2bc2076a821974ed31e99bac9ef2 (patch)
tree78d8d0e3bdef30f690cd2b546302edebc042b3cc /src/comp
parentrustc: Factor out expr_ty() into expr_ann() and expr_ty() (diff)
downloadrust-9d9790c7f50b2bc2076a821974ed31e99bac9ef2.tar.xz
rust-9d9790c7f50b2bc2076a821974ed31e99bac9ef2.zip
rustc: Add a uint hash function
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/util/common.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/comp/util/common.rs b/src/comp/util/common.rs
index b33a7db2..68d518da 100644
--- a/src/comp/util/common.rs
+++ b/src/comp/util/common.rs
@@ -71,6 +71,14 @@ fn new_int_hash[V]() -> std.map.hashmap[int,V] {
ret std.map.mk_hashmap[int,V](hasher, eqer);
}
+fn new_uint_hash[V]() -> std.map.hashmap[uint,V] {
+ fn hash_uint(&uint x) -> uint { ret x; }
+ fn eq_uint(&uint a, &uint b) -> bool { ret a == b; }
+ auto hasher = hash_uint;
+ auto eqer = eq_uint;
+ ret std.map.mk_hashmap[uint,V](hasher, eqer);
+}
+
fn istr(int i) -> str {
ret _int.to_str(i, 10u);
}