Byte ordering at plugin compile time?
dmaxwell at exobox.com
Wed Sep 6 20:41:46 UTC 2000
For those plugin experts out there:
I'm writing a plugin that is attempting to highly optimize some graphics
operations through some handcoding of C statements. Some of these
statements can be better optimized with knowledge of the byte ordering of
the target device at compile time.
Is there a symbol defined anywhere (I've looked but don't see an obvious
one) that I can test with an #ifdef to indicate byte ordering?
For instance, in one place I'm expanding an RGBRGBRGB... sequence into
ARGBARGBARGB... where A==16rFF. The (fast but not pretty) code reads
unsigned int *d;
unsigned char *s;
*d++ = *(unsigned int *)&s[-1] | 0xFF000000; s += 3;
*d++ = (*(unsigned int *)s << 8) | 0xFF; s += 3;
In the case there is none, and I have to define the symbol based on
where's the best way to do this in the Squeak code to get it to show up at
the top of the file?
More information about the Squeak-dev