Christian Weisgerber <na...@mips.inka.de> wrote:

> 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.

Regarding 

+#ifdef __BIG_ENDIAN__

It isn't just non-standard, it is entirely wrong and absolutely breaks
big-endian software since __BIG_ENDIAN__ is always defined as.  One uses
it with comparison...

Reply via email to