@@ -29,7 +29,7 @@ PERFORMANCE OF THIS SOFTWARE.
2929
3030******************************************************************/
3131
32- /* Dictionaru object implementation using a hash table */
32+ /* Dictionary object implementation using a hash table */
3333
3434#include "Python.h"
3535
@@ -81,8 +81,8 @@ static long polys[] = {
8181static PyObject * dummy ; /* Initialized by first call to newdictobject() */
8282
8383/*
84- Invariant for entries: when in use, de_value is not NULL and de_key is
85- not NULL and not dummy; when not in use, de_value is NULL and de_key
84+ Invariant for entries: when in use, me_value is not NULL and me_key is
85+ not NULL and not dummy; when not in use, me_value is NULL and me_key
8686is either NULL or dummy. A dummy key value cannot be replaced by
8787NULL, since otherwise other keys may be lost.
8888*/
@@ -141,14 +141,11 @@ However, instead of going through the table at constant steps, we cycle
141141through the values of GF(2^n)-{0}. This avoids modulo computations, being
142142much cheaper on RISC machines, without leading to clustering.
143143
144- First a 32-bit hash value, 'sum', is computed from the key string.
145- The first character is added an extra time shifted by 8 to avoid hashing
146- single-character keys (often heavily used variables) too close together.
147- All arithmetic on sum should ignore overflow.
148-
149- The initial probe index is then computed as sum mod the table size.
144+ The initial probe index is computed as hash mod the table size.
150145Subsequent probe indices use the values of x^i in GF(2^n) as an offset,
151- where x is a root. The initial value is derived from sum, too.
146+ where x is a root. The initial value is derived from hash, too.
147+
148+ All arithmetic on hash should ignore overflow.
152149
153150(This version is due to Reimer Behrends, some ideas are also due to
154151Jyrki Alakuijala and Vladimir Marangozov.)
@@ -186,7 +183,7 @@ lookdict(mp, key, hash)
186183 freeslot = NULL ;
187184 }
188185 /* XXX What if PyObject_Compare returned an exception? */
189- /* Derive incr from sum , just to make it more arbitrary. Note that
186+ /* Derive incr from hash , just to make it more arbitrary. Note that
190187 incr must not be 0, or we will get into an infinite loop.*/
191188 incr = (hash ^ ((unsigned long )hash >> 3 )) & mask ;
192189 if (!incr )
0 commit comments