diff Objects/object.c @ 65603:be8ae6b17539

follow up to #9778: define and use an unsigned hash type
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 Oct 2010 16:20:50 +0000
parents e8969fb822fc
children 724920a015f7
line wrap: on
line diff
--- a/Objects/object.c	Sat Oct 23 01:15:30 2010 +0000
+++ b/Objects/object.c	Sat Oct 23 16:20:50 2010 +0000
@@ -692,7 +692,7 @@
 {
     int e, sign;
     double m;
-    unsigned long x, y;
+    Py_uhash_t x, y;
 
     if (!Py_IS_FINITE(v)) {
         if (Py_IS_INFINITY(v))
@@ -716,7 +716,7 @@
         x = ((x << 28) & _PyHASH_MODULUS) | x >> (_PyHASH_BITS - 28);
         m *= 268435456.0;  /* 2**28 */
         e -= 28;
-        y = (unsigned long)m;  /* pull out integer part */
+        y = (Py_uhash_t)m;  /* pull out integer part */
         m -= y;
         x += y;
         if (x >= _PyHASH_MODULUS)
@@ -728,8 +728,8 @@
     x = ((x << e) & _PyHASH_MODULUS) | x >> (_PyHASH_BITS - e);
 
     x = x * sign;
-    if (x == (unsigned long)-1)
-        x = (unsigned long)-2;
+    if (x == (Py_uhash_t)-1)
+        x = (Py_uhash_t)-2;
     return (Py_hash_t)x;
 }