Mailing List Archive

CVS: Products/Ape/lib/apelib/zodb3 - storage.py:1.19
Update of /cvs-repository/Products/Ape/lib/apelib/zodb3
In directory cvs.zope.org:/tmp/cvs-serv16672/lib/apelib/zodb3

Modified Files:
storage.py
Log Message:
added comments about 64-bit hashin


=== Products/Ape/lib/apelib/zodb3/storage.py 1.18 => 1.19 ===
--- Products/Ape/lib/apelib/zodb3/storage.py:1.18 Wed Oct 18 09:01:36 2006
+++ Products/Ape/lib/apelib/zodb3/storage.py Wed Oct 18 09:27:15 2006
@@ -88,11 +88,15 @@
"""Returns an 8-byte hash value.
"""
if v < -2L ** 32:
+ # This is a hash on a 64-bit machine. Treat as unsigned
+ # 64-bit integer
v += 2L ** 64
elif v < 0:
- # Treat the hash as an unsigned 32-bit integer
+ # This is a hash on a 32-bit machine. Treat as an unsigned
+ # 32-bit integer
v += 2L ** 32
if v > 2L ** 32:
+ # This still is a hash on 64-bit machine. Compress to 32-bit.
v = v / 2 ** 32

assert v >= 0 and v <= 2L ** 32

_______________________________________________
Zope-CVS maillist - Zope-CVS@zope.org
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS