]> granicus.if.org Git - python/commitdiff
The tail end of x_sub implicitly assumed that an unsigned short
authorTim Peters <tim.peters@gmail.com>
Sat, 8 Jul 2000 02:26:47 +0000 (02:26 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 8 Jul 2000 02:26:47 +0000 (02:26 +0000)
contains 16 bits.  Not true on Cray J90.

Objects/longobject.c

index df69a6da67ac980d8e91c439da6139ee301f8a52..a28dbaf34d7f8c8255ab17029b386bc932c24333 100644 (file)
@@ -1048,6 +1048,7 @@ x_sub(PyLongObject *a, PyLongObject *b)
                borrow = a->ob_digit[i] - borrow;
                z->ob_digit[i] = borrow & MASK;
                borrow >>= SHIFT;
+               borrow &= 1; /* Keep only one sign bit */
        }
        assert(borrow == 0);
        if (sign < 0)