> 2*PyLong_SHIFT" to avoid undefined behaviour when LONG_MAX type is smaller than 60 bits. This change should fix a warning with the ICC compiler. [#24999]">

cpython: 21076e24cd8a (original) (raw)

Mercurial > cpython

changeset 98070:21076e24cd8a 3.5

Issue #24999: In longobject.c, use two shifts instead of ">> 2*PyLong_SHIFT" to avoid undefined behaviour when LONG_MAX type is smaller than 60 bits. This change should fix a warning with the ICC compiler. [#24999]

Victor Stinner victor.stinner@gmail.com
date Sat, 19 Sep 2015 13:39:03 +0200
parents 6899bf8d21c3
children 3704cea9fd8e 138bbb7cf612
files Objects/longobject.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-)[+] [-] Objects/longobject.c 10

line wrap: on

line diff

--- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4495,11 +4495,13 @@ PyObject simple: assert(Py_REFCNT(a) > 0); assert(Py_REFCNT(b) > 0); -#if LONG_MAX >> 2PyLong_SHIFT +/* Issue #24999: use two shifts instead of ">> 2*PyLong_SHIFT" to avoid

#else @@ -4516,9 +4518,9 @@ simple: y = x % y; x = t; } -#if LONG_MAX >> 2PyLong_SHIFT +#if LONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLong(x); -#elif defined(PY_LONG_LONG) && PY_LLONG_MAX >> 2PyLong_SHIFT +#elif defined(PY_LONG_LONG) && PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLongLong(x); #else

error "_PyLong_GCD"