bulia byak wrote:
So the next questions is, do we have an ifdef that filters out only PPC-based Macs? If not, can the autoconfig gurus please help with creating one?
How about a live test? Have an test like endian_type() that returns BIG_ENDIAN or LITTLE_ENDIAN.
If this is too much of a burden at runtime, then add it as a test during config time.
A good way to check is to look at the header of a Java .class file in a hex editor. Check out the magic number 0xcafebabe as bytes, then words.
Simple test: 1. Set a 32-bit int to some literal like 0x11223344; 2: Test byte[0]. If it is 0x11, it is BIG_ENDIAN, if 0x44, it is LITTLE_ENDIAN.
But is value-shifting really that expensive? Assume a canonical format for ARGB or RGBA, always in the same byte order. Shift and mask to get the fields. A bit more work, but infinitely more portable.
A = (pixel >> 24) & 0xff; R = (pixel >> 16) & 0xff; G = (pixel >> 8) & 0xff; B = (pixel ) & 0xff;
bob