64-bit / 128-bit data element type for array?

Robert Kern robert.kern at gmail.com
Mon Dec 22 14:26:34 EST 2008


akineko wrote:
> Hello everyone,
> 
> I need to handle binary files that contain 64-bit (or 128-bit in the
> furture) unsigned int data.
> Python's array seems not supporting unsigned int type beyond 32-bit
> ('L').
> I would like to use Python array as I need to make my program work on
> both big-endian machines as well as on little-endian machines.
> 
> What is the best way to deal with 64-bit / 128-bit data elements in
> Python (must support byteswap())?
> (must be machine-independent)

You might give numpy a try. We support uint64 data even on 32-bit machines 
provided that your C compiler does. I haven't seen uint128 in the wild, though.

http://numpy.scipy.org/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list