George Koehler: > - unsigned char* c = (unsigned char*) &col; return c[i]; > + unsigned char* c = (unsigned char*) &col; > +#ifdef __BIG_ENDIAN__ > + return c[sizeof(col) - i]; > +#else > + return c[i]; > +#endif > }
Off by one: return c[sizeof(col) - 1 - i]; __BIG_ENDIAN__ is nonstandard. Normally, I'd suggest an endian.h-based check, but elsewhere in this code base there's already... #if SDL_BYTEORDER == SDL_BIG_ENDIAN ... so let's use that idiom. -- Christian "naddy" Weisgerber na...@mips.inka.de