[ python-Bugs-1678102 ] zlib.crc32() not cross-platform
SourceForge.net
noreply at sourceforge.net
Tue Mar 13 23:52:26 CET 2007
Bugs item #1678102, was opened at 2007-03-10 20:07
Message generated for change (Comment added) made by gagenellina
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678102&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ben Collver (bencollver)
Assigned to: Nobody/Anonymous (nobody)
Summary: zlib.crc32() not cross-platform
Initial Comment:
The zlib.crc32() function sometimes produces different results for the same input on big and little-endian processors. Same for zlib.adler32().
sparc64:
>>> import zlib
>>> print zlib.adler32("--------------------------------------------------", 1)
> 3763407051
>>> print zlib.crc32("--------------------------------------------------", 1)
3044228349
i386:
>>> import zlib
>>> print zlib.adler32("--------------------------------------------------", 1)
> -531560245
>>> print zlib.crc32("--------------------------------------------------", 1)
-1250738947
----------------------------------------------------------------------
Comment By: Gabriel Genellina (gagenellina)
Date: 2007-03-13 19:52
Message:
Logged In: YES
user_id=479790
Originator: NO
py> -531560245 & 0xffffffff
3763407051L
It's the same number (actually, the same bit pattern). The i386 version is
signed, the other unsigned. The i386 platform uses a 32 bit "int"; the
sparc64 uses 64 bits (I presume). 3763407051 doesnt fit in 31bits, so it's
seen as a negative number.
----------------------------------------------------------------------
Comment By: Ben Collver (bencollver)
Date: 2007-03-10 20:13
Message:
Logged In: YES
user_id=778667
Originator: YES
The extra > characters before the first results come from me pasting the
results to my irc client, then copying from there and pasting here. Sorry
for any confusion.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678102&group_id=5470
More information about the Python-bugs-list
mailing list