Re: SBC big endian issues?

Brad Midgley
2009-01-05T16:25:24Z

Siarhei

> The logic is that the first line contains a portable endian neutral read of
> big endian data into native format:
>> s = (ptr[0] & 0xff) << 8 | (ptr[1] & 0xff);

the intent is to swap bytes using this first statement if either

- host order is little endian and the ptr array is stored big endian
- host order is big endian and the ptr array is stored little endian

the second case could be done with a cast to a 16-bit int rather than
bit arithmetic.

We don't exercise all the various cases.

--
Brad Midgley