[pypy-commit] pypy disable_merge_different_int_types: Fix for unsigned-ness in hash computation
bivab
noreply at buildbot.pypy.org
Mon Nov 28 15:55:42 CET 2011
Author: David Schneider <david.schneider at picle.org>
Branch: disable_merge_different_int_types
Changeset: r49903:f05f7014462b
Date: 2011-11-25 12:40 +0100
http://bitbucket.org/pypy/pypy/changeset/f05f7014462b/
Log: Fix for unsigned-ness in hash computation
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -453,17 +453,16 @@
multi = r_uint(1822399083) + r_uint(1822399083) + 1
if w_set.hash != 0:
return space.wrap(w_set.hash)
- hash = 1927868237
- hash *= (len(w_set.setdata) + 1)
+ hash = r_uint(1927868237)
+ hash *= r_uint(len(w_set.setdata) + 1)
for w_item in w_set.setdata:
h = space.hash_w(w_item)
- value = ((h ^ (h << 16) ^ 89869747) * multi)
- hash = intmask(hash ^ value)
+ value = (r_uint(h ^ (h << 16) ^ 89869747) * multi)
+ hash = hash ^ value
hash = hash * 69069 + 907133923
if hash == 0:
hash = 590923713
- hash = intmask(hash)
- w_set.hash = hash
+ w_set.hash = intmask(hash)
return space.wrap(hash)
More information about the pypy-commit
mailing list