[Lcms-user] ppc64le fixup __BYTE_ORDER__, __LITTLE_ENDIAN__ macro usage
An ICC-based CMM for color management
Brought to you by:
mm2
|
From: Will S. <wil...@vn...> - 2014-03-27 20:20:05
|
lcms2 make check on powerpc64 LE platform was failing it's endianness check. After a bit of debug, we've determined that the __BYTE_ORDER__, and __LITTLE_ENDIAN__ macros used in lcms2.h are missing their trialing underscores, so the intended check is failing for the wrong reasons. Also need to compare the __BYTE_ORDER__ value to the __ORDER_LITTLE_ENDIAN__ value of (4321), instead of to the value of __LITTLE_ENDIAN (1). For reference, The defined macros can be viewed by "gcc -E -dM - < /dev/null". On this platform, the related entries are: #define __ORDER_LITTLE_ENDIAN__ 1234 #define _LITTLE_ENDIAN 1 #define __LITTLE_ENDIAN__ 1 #define __ORDER_BIG_ENDIAN__ 4321 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ Thanks, -Will diff --git a/include/lcms2.h b/include/lcms2.h index a0eeea7..29b0d6d 100644 --- a/include/lcms2.h +++ b/include/lcms2.h @@ -192,8 +192,8 @@ typedef int cmsBool; #if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_CPU_PPC) # define CMS_USE_BIG_ENDIAN 1 -# if defined (__GNUC__) && defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) -# if __BYTE_ORDER == __LITTLE_ENDIAN +# if defined (__GNUC__) && defined(__BYTE_ORDER__) && defined(__LITTLE_ENDIAN__) +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ // // Don't use big endian for PowerPC little endian mode # undef CMS_USE_BIG_ENDIAN # endif |