Byte ordering at plugin compile time?
Duane Maxwell
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
something like:
unsigned int *d;
unsigned char *s;
...
#ifdef BIG_ENDIAN
*d++ = *(unsigned int *)&s[-1] | 0xFF000000; s += 3;
#else
*d++ = (*(unsigned int *)s << 8) | 0xFF; s += 3;
#endif
In the case there is none, and I have to define the symbol based on
platform, ie.
#ifdef macintosh
#define BIG_ENDIAN
#endif
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
|