From: Tim Peters Date: Sun, 11 Aug 2002 17:54:42 +0000 (+0000) Subject: int_lshift(): Simplified/sped overflow-checking. X-Git-Tag: v2.3c1~4546 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da1a2212c8ddbb0dfb00fc1cb1c04fce4794d9ab;p=thirdparty%2FPython%2Fcpython.git int_lshift(): Simplified/sped overflow-checking. --- diff --git a/Objects/intobject.c b/Objects/intobject.c index 40f38ba343be..1d05a631c2a0 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -675,15 +675,13 @@ int_lshift(PyIntObject *v, PyIntObject *w) return NULL; return PyInt_FromLong(0L); } - c = a < 0 ? ~a : a; - c >>= LONG_BIT - 1 - b; - if (c) { + c = a << b; + if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) { if (PyErr_Warn(PyExc_DeprecationWarning, "x<