From 9d9790c7f50b2bc2076a821974ed31e99bac9ef2 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 11 Apr 2011 16:54:05 -0700 Subject: rustc: Add a uint hash function --- src/comp/util/common.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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); } -- cgit v1.2.3