Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45daeb0 commit da1a221Copy full SHA for da1a221
1 file changed
Objects/intobject.c
@@ -675,15 +675,13 @@ int_lshift(PyIntObject *v, PyIntObject *w)
675
return NULL;
676
return PyInt_FromLong(0L);
677
}
678
- c = a < 0 ? ~a : a;
679
- c >>= LONG_BIT - 1 - b;
680
- if (c) {
+ c = a << b;
+ if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) {
681
if (PyErr_Warn(PyExc_DeprecationWarning,
682
"x<<y losing bits or changing sign "
683
"will return a long in Python 2.4 and up") < 0)
684
685
686
- c = (long)((unsigned long)a << b);
687
return PyInt_FromLong(c);
688
689
0 commit comments