Skip to content

Commit 9d9790c

Browse files
committed
rustc: Add a uint hash function
1 parent e0faf57 commit 9d9790c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/comp/util/common.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ fn new_int_hash[V]() -> std.map.hashmap[int,V] {
7171
ret std.map.mk_hashmap[int,V](hasher, eqer);
7272
}
7373

74+
fn new_uint_hash[V]() -> std.map.hashmap[uint,V] {
75+
fn hash_uint(&uint x) -> uint { ret x; }
76+
fn eq_uint(&uint a, &uint b) -> bool { ret a == b; }
77+
auto hasher = hash_uint;
78+
auto eqer = eq_uint;
79+
ret std.map.mk_hashmap[uint,V](hasher, eqer);
80+
}
81+
7482
fn istr(int i) -> str {
7583
ret _int.to_str(i, 10u);
7684
}

0 commit comments

Comments
 (0)