[Python-checkins] python/dist/src/Lib pickletools.py,1.6,1.7
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Mon, 27 Jan 2003 15:51:13 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv5445/Lib
Modified Files:
pickletools.py
Log Message:
decode_long(): Simplified the "is it negative?" test.
Index: pickletools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickletools.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pickletools.py 27 Jan 2003 22:47:53 -0000 1.6
--- pickletools.py 27 Jan 2003 23:51:11 -0000 1.7
***************
*** 591,595 ****
>>> decode_long("\x00\x80")
-32768L
! >>>
"""
x = 0L
--- 591,598 ----
>>> decode_long("\x00\x80")
-32768L
! >>> decode_long("\x80")
! -128L
! >>> decode_long("\x7f")
! 127L
"""
x = 0L
***************
*** 598,602 ****
x |= long(ord(c)) << i
i += 8L
! if i and (x & (1L << (i-1L))):
x -= 1L << i
return x
--- 601,605 ----
x |= long(ord(c)) << i
i += 8L
! if data and ord(c) >= 0x80:
x -= 1L << i
return x