[Python-checkins] python/dist/src/Objects longobject.c,1.141,1.142
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Tue, 20 Aug 2002 12:00:26 -0700
- Previous message: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,NONE,1.1 obj_datetime.c,NONE,1.1 obj_delta.c,NONE,1.1 Makefile,1.4,1.5 datetime.c,1.11,1.12 datetime.h,1.4,1.5 setup.py,1.1,1.2 test_cdatetime.py,1.4,1.5
- Next message: [Python-checkins] python/nondist/sandbox/datetime Makefile,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv12415/python/Objects
Modified Files:
longobject.c
Log Message:
long_format(), long_lshift(): Someone on c.l.py is trying to boost
SHIFT and MASK, and widen digit. One problem is that code of the form
digit << small_integer
implicitly assumes that the result fits in an int or unsigned int
(platform-dependent, but "int sized" in any case), since digit is
promoted "just" to int or unsigned via the usual integer promotions.
But if digit is typedef'ed as unsigned int, this loses information.
The cure for this is just to cast digit to twodigits first.
Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -C2 -d -r1.141 -r1.142
*** longobject.c 15 Aug 2002 20:10:45 -0000 1.141
--- longobject.c 20 Aug 2002 19:00:22 -0000 1.142
***************
*** 950,954 ****
for (i = 0; i < size_a; ++i) {
! accum |= a->ob_digit[i] << accumbits;
accumbits += SHIFT;
assert(accumbits >= basebits);
--- 950,954 ----
for (i = 0; i < size_a; ++i) {
! accum |= (twodigits)a->ob_digit[i] << accumbits;
accumbits += SHIFT;
assert(accumbits >= basebits);
***************
*** 2346,2350 ****
accum = 0;
for (i = wordshift, j = 0; j < oldsize; i++, j++) {
! accum |= a->ob_digit[j] << remshift;
z->ob_digit[i] = (digit)(accum & MASK);
accum >>= SHIFT;
--- 2346,2350 ----
accum = 0;
for (i = wordshift, j = 0; j < oldsize; i++, j++) {
! accum |= (twodigits)a->ob_digit[j] << remshift;
z->ob_digit[i] = (digit)(accum & MASK);
accum >>= SHIFT;
- Previous message: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,NONE,1.1 obj_datetime.c,NONE,1.1 obj_delta.c,NONE,1.1 Makefile,1.4,1.5 datetime.c,1.11,1.12 datetime.h,1.4,1.5 setup.py,1.1,1.2 test_cdatetime.py,1.4,1.5
- Next message: [Python-checkins] python/nondist/sandbox/datetime Makefile,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]