[PD-dev] examples of porting endianness?

Mathieu Bouchard matju at sympatico.ca
Thu Feb 27 00:38:40 CET 2003


On Wed, 26 Feb 2003, Mathieu Bouchard wrote:

> suppose you have:
>    char data[4]; /* float data directly from a file */
>    int x = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);

a little amendment: the type of "data" must be unsigned char, else the
conversion of step 1 will be wrong. however the signedness of the type of
"x" does not matter.

Tigital's code may be faster than mine (or some parts of it may be, i
don't know) if you accept the fact that it contains mac-only code.

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju





More information about the Pd-dev mailing list