diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-04-12 20:33:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-04-12 21:30:53 +0000 |
commit | 473472ea3c5e38395a35195f728f5b6ed449318b (patch) | |
tree | d9d5b367372236af1cf8441b441da3c819d9c4bd /include/osl | |
parent | ec53ac63e342d9d00e1aed4372a903630b6a191b (diff) |
Skip intermediate _LITTLE/BIG_ENDIAN when determining OSL_LIT/BIGENDIAN
Change-Id: I1e3247a15eef62455e48229732418e7c824bb0b4
Reviewed-on: https://gerrit.libreoffice.org/24036
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/osl')
-rw-r--r-- | include/osl/endian.h | 134 |
1 files changed, 29 insertions, 105 deletions
diff --git a/include/osl/endian.h b/include/osl/endian.h index 4043c403d86d..ebc48541230b 100644 --- a/include/osl/endian.h +++ b/include/osl/endian.h @@ -26,132 +26,56 @@ extern "C" { #endif -/** Determine the platform byte order as _BIG_ENDIAN, _LITTLE_ENDIAN, ... +/** Define the platform byte order as OSL_BIGENDIAN or OSL_LITENDIAN. */ -#ifdef _WIN32 -# if defined(_M_IX86) -# define _LITTLE_ENDIAN -# elif defined(_M_AMD64) -# define _LITTLE_ENDIAN -# elif defined(_M_MRX000) -# define _LITTLE_ENDIAN -# elif defined(_M_ALPHA) -# define _LITTLE_ENDIAN -# elif defined(_M_PPC) -# define _LITTLE_ENDIAN -# endif -#endif -#ifdef LINUX -# include <endian.h> -# if __BYTE_ORDER == __LITTLE_ENDIAN -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN -# endif -# elif __BYTE_ORDER == __BIG_ENDIAN -# ifndef _BIG_ENDIAN -# define _BIG_ENDIAN -# endif +#if defined _WIN32 +# if defined _M_ALPHA || defined _M_AMD64 || defined _M_IX86 \ + || defined _M_MRX000 || defined _M_PPC +# define OSL_LITENDIAN # endif -#endif - -#ifdef ANDROID +#elif defined ANDROID || defined LINUX # include <endian.h> # if __BYTE_ORDER == __LITTLE_ENDIAN -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN -# endif +# define OSL_LITENDIAN # elif __BYTE_ORDER == __BIG_ENDIAN -# ifndef _BIG_ENDIAN -# define _BIG_ENDIAN -# endif -# endif -#endif - -#ifdef EMSCRIPTEN -# include <endian.h> -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN +# define OSL_BIGENDIAN # endif -#endif - -#ifdef NETBSD +#elif defined EMSCRIPTEN +# define OSL_LITENDIAN +#elif defined IOS || defined MACOSX || defined NETBSD # include <machine/endian.h> # if BYTE_ORDER == LITTLE_ENDIAN -# undef _BIG_ENDIAN +# define OSL_LITENDIAN # elif BYTE_ORDER == BIG_ENDIAN -# undef _LITTLE_ENDIAN +# define OSL_BIGENDIAN # endif -#endif - -#ifdef FREEBSD +#elif defined FREEBSD # include <sys/param.h> # include <machine/endian.h> -#endif - -#ifdef AIX +# if defined _LITTLE_ENDIAN +# define OSL_LITENDIAN +# elif defined _BIG_ENDIAN +# define OSL_BIGENDIAN +# endif +#elif defined AIX # include <sys/machine.h> # if BYTE_ORDER == LITTLE_ENDIAN -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN -# endif +# define OSL_LITENDIAN # elif BYTE_ORDER == BIG_ENDIAN -# ifndef _BIG_ENDIAN -# define _BIG_ENDIAN -# endif +# define OSL_BIGENDIAN # endif -#endif - -#ifdef SOLARIS +#elif defined SOLARIS # include <sys/isa_defs.h> -#endif - -#ifdef MACOSX -# include <machine/endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN -# endif -# elif BYTE_ORDER == BIG_ENDIAN -# ifndef _BIG_ENDIAN -# define _BIG_ENDIAN -# endif -# endif -#endif - -#ifdef IOS -# include <machine/endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# ifndef _LITTLE_ENDIAN -# define _LITTLE_ENDIAN -# endif -# elif BYTE_ORDER == BIG_ENDIAN -# ifndef _BIG_ENDIAN -# define _BIG_ENDIAN -# endif +# if defined _LITTLE_ENDIAN +# define OSL_LITENDIAN +# elif defined _BIG_ENDIAN +# define OSL_BIGENDIAN # endif -#endif - -/** Check supported platform. - */ -#if !defined(_WIN32) && \ - !defined(LINUX) && !defined(NETBSD) && \ - !defined(AIX) && !defined(OPENBSD) && \ - !defined(SOLARIS) && !defined(MACOSX) && !defined(FREEBSD) && \ - !defined(DRAGONFLY) && \ - !defined(IOS) && !defined(ANDROID) && \ - !defined(EMSCRIPTEN) +#else # error "Target platform not specified !" #endif - - -/** Define the determined byte order as OSL_BIGENDIAN or OSL_LITENDIAN. - */ -#if defined _LITTLE_ENDIAN -# define OSL_LITENDIAN -#elif defined _BIG_ENDIAN -# define OSL_BIGENDIAN -#else +#if defined OSL_LITENDIAN == defined OSL_BIGENDIAN # error undetermined endianness #endif |