Byte ordering at plugin compile time?

Duane Maxwell dmaxwell at
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
something like:

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
platform, ie.

#ifdef macintosh
#define BIG_ENDIAN

where's the best way to do this in the Squeak code to get it to show up at
the top of the file?

Thanks --

-- Duane

More information about the Squeak-dev mailing list