# Unsigned char array to an unsigned longlong array

Francis Brissette Francis.Brissette at autodesk.com
Tue Aug 11 19:39:49 CEST 2009

```Hello,

I'm using Python 2.6.2.
Is there a way to have an Array of unsigned longlong (C Type: unsigned longlong, Minimum size if bytes: 8) ?
I found a page on the internet (http://mail.python.org/pipermail/patches/2005-April/017430.html), but I'm not quite sure if it is available.

What I want to do is to store an array of bytes in an array of longlongs.
To workaround this issue, I have tried to use the double array (TypeCode 'd'), since the size in bytes is the same (8 for instance).
But it gives me strange result. Please look at the example:

import array
myByteArray = array.array('B', [1,2,3,4,5,6,7,8])
>> myByteArray = array('B', [1, 2, 3, 4, 5, 6, 7, 8])

myLongArray = array.array('L', myByteArray.tostring() )
myLongArray = array('L', [67305985L, 134678021L])

myDoubleArray = array.array('d', myByteArray.tostring() )
myDoubleArray = array('d', [5.447603722011605e-270])

If we convert the byte array to an hex form, we will get for the long array: [04030201, 08070605].
If we convert this hex array to decimal, we then get the Long Array: [67305985, 134678021].

Now, if we do the same exercise for the double array, the hex form will look like: [0807060504030201].
And the decimal value would be: [5.784376957523072e+17].

Where does the 5.447603722011605e-270 value comes from ?