[Python-checkins] python/dist/src/Objects intobject.c,2.88,2.89

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Sun, 11 Aug 2002 10:54:44 -0700


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

Modified Files:
	intobject.c 
Log Message:
int_lshift():  Simplified/sped overflow-checking.


Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.88
retrieving revision 2.89
diff -C2 -d -r2.88 -r2.89
*** intobject.c	11 Aug 2002 14:04:13 -0000	2.88
--- intobject.c	11 Aug 2002 17:54:42 -0000	2.89
***************
*** 676,682 ****
  		return PyInt_FromLong(0L);
  	}
! 	c = a < 0 ? ~a : a;
! 	c >>= LONG_BIT - 1 - b;
! 	if (c) {
  		if (PyErr_Warn(PyExc_DeprecationWarning,
  			       "x<<y losing bits or changing sign "
--- 676,681 ----
  		return PyInt_FromLong(0L);
  	}
! 	c = a << b;
! 	if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) {
  		if (PyErr_Warn(PyExc_DeprecationWarning,
  			       "x<<y losing bits or changing sign "
***************
*** 684,688 ****
  			return NULL;
  	}
- 	c = (long)((unsigned long)a << b);
  	return PyInt_FromLong(c);
  }
--- 683,686 ----