Author: Maciej Fijalkowski <[email protected]>
Branch: rdict-experiments
Changeset: r59787:f5d98ccd462f
Date: 2013-01-05 22:52 +0200
http://bitbucket.org/pypy/pypy/changeset/f5d98ccd462f/
Log: eh, comparison too?
diff --git a/pypy/rlib/dict.py b/pypy/rlib/dict.py
--- a/pypy/rlib/dict.py
+++ b/pypy/rlib/dict.py
@@ -11,8 +11,8 @@
('value', llmemory.GCREF)))
MAIN_TP = lltype.GcArray(rffi.INT_real)
-FREE = rffi.cast(rffi.INT_real, -1)
-DUMMY = rffi.cast(rffi.INT_real, -2)
+FREE = -1
+DUMMY = -2
class Dict(object):
'Space efficient dictionary with fast iteration and cheap resizes.'
@@ -48,7 +48,7 @@
#if n <= 2**31: return array.array('l', [FREE]) * n # signed long
v = lltype.malloc(MAIN_TP, n)
for i in range(n):
- v[i] = FREE
+ v[i] = rffi.cast(rffi.INT_real, FREE)
return v
def _resize(self, n):
@@ -71,7 +71,7 @@
perturb = hashvalue
i = hashvalue & (n - 1)
while True:
- if self.indices[i] == FREE:
+ if rffi.cast(lltype.Signed, self.indices[i]) == FREE:
break
i = 5 * i + perturb + 1
i = i & (n - 1)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit