unsigned 32 bit arithmetic type?

Travis E. Oliphant oliphant.travis at ieee.org
Wed Oct 25 06:21:01 EDT 2006


Robin Becker wrote:
> 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.


NumPy defines an array and an array scalar for all signed and unsigned 
integers defined in C.

import numpy as nx
type(nx.array([1,2,3],dtype=nx.uint32)[0])

<type 'numpy.uint32'>






More information about the Python-list mailing list