about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2011-12-07 08:14:57 -0800
committerNiko Matsakis <niko@alum.mit.edu>2011-12-07 17:05:58 -0800
commit4b704ac69b17d8d338c25cdb24f8bcdfbd7565a4 (patch)
treecbccf998f33f689e373b3e73c9ab140af5e73fdc /src/libstd
parented0e13f1d86124845606fd378f4ab3cec3d1c9b3 (diff)
downloadrust-4b704ac69b17d8d338c25cdb24f8bcdfbd7565a4.tar.gz
rust-4b704ac69b17d8d338c25cdb24f8bcdfbd7565a4.zip
improve comments
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/map.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index c581186e4d1..833a7af5957 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -9,7 +9,9 @@ A hashmap
 /*
 Type: hashfn
 
-A function that returns a hash of a value
+A function that returns a hash of a value.
+The hash should concentrate entropy in the
+lower bits.
 */
 type hashfn<K> = fn(K) -> uint;
 
@@ -352,9 +354,15 @@ mod chained {
 }
 
 /*
-Function: mk_hashmap
+Function: mk_flat_hashmap
+
+Construct a "flat" hashmap, meaning that there are
+not chains per buckets, but rather we search a sequence
+of buckets for each key.
 
-Construct a hashmap
+Warning: it is unclear to me that this code is correct
+on 32-bit processors.  Check out the 'hash-tearing' code
+in hash() and the comment surrounding it. - Niko
 
 Parameters:
 
@@ -550,6 +558,16 @@ fn mk_flat_hashmap<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>)
     ret hashmap(hasher, eqer, bkts, initial_capacity, 0u, load_factor);
 }
 
+/*
+Function: mk_hashmap
+
+Construct a hashmap.
+
+Parameters:
+
+hasher - The hash function for key type K
+eqer - The equality function for key type K
+*/
 fn mk_hashmap<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>)
     -> hashmap<K, V> {
     ret chained::mk(hasher, eqer);