unsigned 32 bit arithmetic type?

"Martin v. Löwis" martin at v.loewis.de
Wed Oct 25 07:28:18 EDT 2006


Robin Becker schrieb:
> Hi, just trying to avoid wheel reinvention. I have need of an unsigned
> 32 bit arithmetic type to carry out a checksum operation and wondered if
> anyone had already defined such a beast.
> 
> Our current code works with 32 bit cpu's, but is failing with 64 bit
> comparisons; it's clearly wrong as we are comparing a number with a
> negated number; the bits might drop off in 32 bits, but not in 64.

Not sure what operations you are doing: In Python, bits never drop off
(at least not in recent versions).

If you need to drop bits, you need to do so explicitly, by using the
bit mask operations. I could tell you more if you'd tell us what
the specific operations are.

Regards,
Martin



More information about the Python-list mailing list