]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
long_format(), long_lshift(): Someone on c.l.py is trying to boost
authorTim Peters <tim.peters@gmail.com>
Tue, 20 Aug 2002 19:00:22 +0000 (19:00 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 20 Aug 2002 19:00:22 +0000 (19:00 +0000)
commit0d2d87d202c62182983c9d7edce978a0c9c9aad1
tree0244207cba1e0783d42f08d11b534746100060fe
parent76afbd9aa41bf34f488a7a1e759622c7f1830cff
long_format(), long_lshift():  Someone on c.l.py is trying to boost
SHIFT and MASK, and widen digit.  One problem is that code of the form

    digit << small_integer

implicitly assumes that the result fits in an int or unsigned int
(platform-dependent, but "int sized" in any case), since digit is
promoted "just" to int or unsigned via the usual integer promotions.
But if digit is typedef'ed as unsigned int, this loses information.
The cure for this is just to cast digit to twodigits first.
Objects/longobject.c