Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib.crc32() not cross-platform #44695

Closed
bencollver mannequin opened this issue Mar 10, 2007 · 3 comments
Closed

zlib.crc32() not cross-platform #44695

bencollver mannequin opened this issue Mar 10, 2007 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@bencollver
Copy link
Mannequin

bencollver mannequin commented Mar 10, 2007

BPO 1678102

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-03-13.22:52:26.000>
created_at = <Date 2007-03-10.23:07:43.000>
labels = ['invalid', 'library']
title = 'zlib.crc32() not cross-platform'
updated_at = <Date 2007-03-13.22:52:26.000>
user = 'https://bugs.python.org/bencollver'

bugs.python.org fields:

activity = <Date 2007-03-13.22:52:26.000>
actor = 'ggenellina'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2007-03-10.23:07:43.000>
creator = 'bencollver'
dependencies = []
files = []
hgrepos = []
issue_num = 1678102
keywords = []
message_count = 3.0
messages = ['31476', '31477', '31478']
nosy_count = 2.0
nosy_names = ['ggenellina', 'bencollver']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1678102'
versions = ['Python 2.5']

@bencollver
Copy link
Mannequin Author

bencollver mannequin commented Mar 10, 2007

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

@bencollver bencollver mannequin closed this as completed Mar 10, 2007
@bencollver bencollver mannequin added invalid stdlib Python modules in the Lib dir labels Mar 10, 2007
@bencollver bencollver mannequin closed this as completed Mar 10, 2007
@bencollver bencollver mannequin added invalid stdlib Python modules in the Lib dir labels Mar 10, 2007
@bencollver
Copy link
Mannequin Author

bencollver mannequin commented Mar 10, 2007

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.

@ggenellina
Copy link
Mannequin

ggenellina mannequin commented Mar 13, 2007

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants