[Python-checkins] python/dist/src/Objects longobject.c,1.159,1.160

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Mon, 05 May 2003 13:39:46 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv11556/python/Objects

Modified Files:
	longobject.c 
Log Message:
SF patch 730594:  assert from longobject.c, line 1215.
Some version of gcc in the "RTEMS port running on the Coldfire (m5200)
processor" generates bad code for a loop in long_from_binary_base(),
comparing the wrong half of an int to a short.  The patch changes the
decl of the short temp to be an int temp instead.  This "simplifies"
the code enough that gcc no longer blows it.


Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -C2 -d -r1.159 -r1.160
*** longobject.c	1 May 2003 21:31:53 -0000	1.159
--- longobject.c	5 May 2003 20:39:43 -0000	1.160
***************
*** 1202,1207 ****
  	pdigit = z->ob_digit;
  	while (--p >= start) {
! 		unsigned char ch = (unsigned char)*p;
! 		digit k;
  
  		if (ch <= '9')
--- 1202,1207 ----
  	pdigit = z->ob_digit;
  	while (--p >= start) {
! 		int k;
! 		char ch = *p;
  
  		if (ch <= '9')
***************
*** 1213,1218 ****
  			k = ch - 'A' + 10;
  		}
! 		assert(k < base);
! 		accum |= k << bits_in_accum;
  		bits_in_accum += bits_per_char;
  		if (bits_in_accum >= SHIFT) {
--- 1213,1218 ----
  			k = ch - 'A' + 10;
  		}
! 		assert(k >= 0 && k < base);
! 		accum |= (twodigits)(k << bits_in_accum);
  		bits_in_accum += bits_per_char;
  		if (bits_in_accum >= SHIFT) {