Need help with an array problem.
jstroud at mbi.ucla.edu
Tue Oct 3 00:02:02 CEST 2006
> Basically I think the problem is in converting from a 32 bit integer to
> a 16 bit integer.
> I have two arrays:
> import array
> a = array.array('L', )
> b = array.array('H', )
> b = a
> Which gives an overflow message....
> So can't I truncate the long by discaring the upper bits ..
> Like b = 0x0000FFFF & a
> How does one normally cast an object from long to short?
Take the modulo 65536?
py> array.array('H', (array.array('L', [65537%65536])))
UCLA-DOE Institute for Genomics and Proteomics
Los Angeles, CA 90095
More information about the Python-list