[Python-checkins] python/dist/src/Objects longobject.c,1.155,1.156
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Sun, 23 Feb 2003 15:11:43 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv10861/Objects
Modified Files:
longobject.c
Log Message:
Fix SF bug #689659, 64-bit int and long hash keys incompatible
On a 64-bit machine, a dictionary could contain duplicate int/long keys
if the value was > 2**32.
Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** longobject.c 3 Feb 2003 15:28:19 -0000 1.155
--- longobject.c 23 Feb 2003 23:11:40 -0000 1.156
***************
*** 1491,1499 ****
i = -(i);
}
while (--i >= 0) {
! /* Force a 32-bit circular shift */
! x = ((x << SHIFT) & ~MASK) | ((x >> (32-SHIFT)) & MASK);
x += v->ob_digit[i];
}
x = x * sign;
if (x == -1)
--- 1491,1501 ----
i = -(i);
}
+ #define LONG_BIT_SHIFT (8*sizeof(long) - SHIFT)
while (--i >= 0) {
! /* Force a native long #-bits (32 or 64) circular shift */
! x = ((x << SHIFT) & ~MASK) | ((x >> LONG_BIT_SHIFT) & MASK);
x += v->ob_digit[i];
}
+ #undef LONG_BIT_SHIFT
x = x * sign;
if (x == -1)