A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/1999-December/001639.html below:

[Distutils] Questions about distutils strategy

[Python-Dev] Re: [Distutils] Questions about distutils strategy [Python-Dev] Re: [Distutils] Questions about distutils strategyTim Peters tim_one@email.msn.com
Wed, 15 Dec 1999 02:40:11 -0500
[JimA posts his Python rendering of Gary Brown's code]

Yup!  That's the zip algorithm, right down to the absurdly bit-reversed
polynomial.

> def crc32(string):
>   crc = 0xFFFFFFFF
>   for ch in string:
>     crc = crc_32_tab[((crc) ^ ord(ch)) & 0xff] ^ (((crc) >> 8) &
> 0xFFFFFF)
>   return ~crc

Note that the last line is better (whether in Python or C!) as

    return crc ^ 0xffffffff

Else you'll get a surprising result in a 64-bit Python, and in some 64-bit C
implementations.

it's-a-32-bit-algorithm-not-an-"int"-or-"long"-one-ly y'rs  - tim





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4