diff options
author | Dylan Baker <[email protected]> | 2018-09-06 15:13:22 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-11-05 16:39:55 +0000 |
commit | f9f60da813e69aacf541d25a24622c896f15ba98 (patch) | |
tree | ce1ba60e57b85a9ea16cfe12efcf3e1ab994d596 /src/util/u_endian.h | |
parent | 37e54736a7bab3397e316ae4493c2e3d4aebfa5e (diff) |
util/u_endian: set PIPE_ARCH_*_ENDIAN to 1
This will allow it to be used as a drop in replacement for
_mesa_little_endian in a number of cases.
v2: - Always define PIPE_ARCH_LITTLE_ENDIAN and PIPE_ARCH_BIG_ENDIAN,
define the one that reflects the host system to 1 and the other to 0
- replace all uses of #ifdef, #ifndef, and #if defined() with #if
and #if ! with PIPE_ARCH_*_ENDIAN
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/util/u_endian.h')
-rw-r--r-- | src/util/u_endian.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/util/u_endian.h b/src/util/u_endian.h index 7ec51380ffa..07f8d8cfc85 100644 --- a/src/util/u_endian.h +++ b/src/util/u_endian.h @@ -31,27 +31,33 @@ #include <endian.h> #if __BYTE_ORDER == __LITTLE_ENDIAN -# define PIPE_ARCH_LITTLE_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 1 +# define PIPE_ARCH_BIG_ENDIAN 0 #elif __BYTE_ORDER == __BIG_ENDIAN -# define PIPE_ARCH_BIG_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 0 +# define PIPE_ARCH_BIG_ENDIAN 1 #endif #elif defined(__APPLE__) #include <machine/endian.h> #if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN -# define PIPE_ARCH_LITTLE_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 1 +# define PIPE_ARCH_BIG_ENDIAN 0 #elif __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN -# define PIPE_ARCH_BIG_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 0 +# define PIPE_ARCH_BIG_ENDIAN 1 #endif #elif defined(__sun) #include <sys/isa_defs.h> #if defined(_LITTLE_ENDIAN) -# define PIPE_ARCH_LITTLE_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 1 +# define PIPE_ARCH_BIG_ENDIAN 0 #elif defined(_BIG_ENDIAN) -# define PIPE_ARCH_BIG_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 0 +# define PIPE_ARCH_BIG_ENDIAN 1 #endif #elif defined(__OpenBSD__) || defined(__NetBSD__) || \ @@ -60,14 +66,17 @@ #include <machine/endian.h> #if _BYTE_ORDER == _LITTLE_ENDIAN -# define PIPE_ARCH_LITTLE_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 1 +# define PIPE_ARCH_BIG_ENDIAN 0 #elif _BYTE_ORDER == _BIG_ENDIAN -# define PIPE_ARCH_BIG_ENDIAN +# define PIPE_ARCH_LITTLE_ENDIAN 0 +# define PIPE_ARCH_BIG_ENDIAN 1 #endif #elif defined(_WIN32) -#define PIPE_ARCH_LITTLE_ENDIAN +#define PIPE_ARCH_LITTLE_ENDIAN 1 +#define PIPE_ARCH_BIG_ENDIAN 0 #endif |