Skip to content

Commit 985f4f9

Browse files
committed
---
yaml --- r: 6626 b: refs/heads/master c: 4b704ac h: refs/heads/master v: v3
1 parent 8943b53 commit 985f4f9

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: ed0e13f1d86124845606fd378f4ab3cec3d1c9b3
2+
refs/heads/master: 4b704ac69b17d8d338c25cdb24f8bcdfbd7565a4

trunk/src/libstd/map.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ A hashmap
99
/*
1010
Type: hashfn
1111
12-
A function that returns a hash of a value
12+
A function that returns a hash of a value.
13+
The hash should concentrate entropy in the
14+
lower bits.
1315
*/
1416
type hashfn<K> = fn(K) -> uint;
1517

@@ -352,9 +354,15 @@ mod chained {
352354
}
353355

354356
/*
355-
Function: mk_hashmap
357+
Function: mk_flat_hashmap
358+
359+
Construct a "flat" hashmap, meaning that there are
360+
not chains per buckets, but rather we search a sequence
361+
of buckets for each key.
356362
357-
Construct a hashmap
363+
Warning: it is unclear to me that this code is correct
364+
on 32-bit processors. Check out the 'hash-tearing' code
365+
in hash() and the comment surrounding it. - Niko
358366
359367
Parameters:
360368
@@ -550,6 +558,16 @@ fn mk_flat_hashmap<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>)
550558
ret hashmap(hasher, eqer, bkts, initial_capacity, 0u, load_factor);
551559
}
552560

561+
/*
562+
Function: mk_hashmap
563+
564+
Construct a hashmap.
565+
566+
Parameters:
567+
568+
hasher - The hash function for key type K
569+
eqer - The equality function for key type K
570+
*/
553571
fn mk_hashmap<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>)
554572
-> hashmap<K, V> {
555573
ret chained::mk(hasher, eqer);

0 commit comments

Comments
 (0)