diff --git a/gfx/qcms/iccread.c b/gfx/qcms/iccread.c index af548892b9f1..c721fbe1988e 100644 --- a/gfx/qcms/iccread.c +++ b/gfx/qcms/iccread.c @@ -29,17 +29,13 @@ typedef uint32_t __be32; typedef uint16_t __be16; -#if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) -#error Unknown endianess -#endif - #if 0 not used yet /* __builtin_bswap isn't available in older gccs * so open code it for now */ static __be32 cpu_to_be32(int32_t v) { -#ifdef LITTLE_ENDIAN +#ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); //return __builtin_bswap32(v); return v; @@ -49,7 +45,7 @@ static __be32 cpu_to_be32(int32_t v) static uint32_t be32_to_cpu(__be32 v) { -#ifdef LITTLE_ENDIAN +#ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); //return __builtin_bswap32(v); #else @@ -59,7 +55,7 @@ static uint32_t be32_to_cpu(__be32 v) static uint32_t be16_to_cpu(__be16 v) { -#ifdef LITTLE_ENDIAN +#ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 8) | ((v & 0xff00) >> 8); #else return v; diff --git a/gfx/qcms/qcmstypes.h b/gfx/qcms/qcmstypes.h index d81e985cae6f..25ffa57a0a11 100644 --- a/gfx/qcms/qcmstypes.h +++ b/gfx/qcms/qcmstypes.h @@ -5,15 +5,7 @@ #include "prtypes.h" -#if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) -#ifdef IS_LITTLE_ENDIAN -#define LITTLE_ENDIAN -#endif - -#ifdef IS_BIG_ENDIAN -#define BIG_ENDIAN -#endif -#endif +/* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */ #if defined (__SVR4) && defined (__sun) /* int_types.h gets included somehow, so avoid redefining the types differently */ @@ -40,14 +32,24 @@ typedef PRUptrdiff uintptr_t; #else // MOZ_QCMS +#if BYTE_ORDER == LITTLE_ENDIAN +#define IS_LITTLE_ENDIAN +#elif BYTE_ORDER == BIG_ENDIAN +#define IS_BIG_ENDIAN +#endif + /* all of the platforms that we use _MSC_VER on are little endian * so this is sufficient for now */ #ifdef _MSC_VER -#define LITTLE_ENDIAN +#define IS_LITTLE_ENDIAN #endif #ifdef __OS2__ -#define LITTLE_ENDIAN +#define IS_LITTLE_ENDIAN +#endif + +#if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) +#error Unknown endianess #endif #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__)