summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sha1/sha1.c2
-rw-r--r--src/util/u_endian.h27
-rw-r--r--src/util/u_math.h4
3 files changed, 21 insertions, 12 deletions
diff --git a/src/util/sha1/sha1.c b/src/util/sha1/sha1.c
index f36a77c2026..78b3da31d0e 100644
--- a/src/util/sha1/sha1.c
+++ b/src/util/sha1/sha1.c
@@ -25,7 +25,7 @@
* blk0() and blk() perform the initial expand.
* I got the idea of expanding during the round function from SSLeay
*/
-#ifdef PIPE_ARCH_LITTLE_ENDIAN
+#if PIPE_ARCH_LITTLE_ENDIAN
# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|(rol(block->l[i],8)&0x00FF00FF))
#else
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
diff --git a/src/util/u_math.h b/src/util/u_math.h
index 7b779c79ca7..4c3aafe80ab 100644
--- a/src/util/u_math.h
+++ b/src/util/u_math.h
@@ -569,7 +569,7 @@ util_bitreverse(unsigned n)
* Convert from little endian to CPU byte order.
*/
-#ifdef PIPE_ARCH_BIG_ENDIAN
+#if PIPE_ARCH_BIG_ENDIAN
#define util_le64_to_cpu(x) util_bswap64(x)
#define util_le32_to_cpu(x) util_bswap32(x)
#define util_le16_to_cpu(x) util_bswap16(x)
@@ -627,7 +627,7 @@ util_bswap16(uint16_t n)
static inline void*
util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n)
{
-#ifdef PIPE_ARCH_BIG_ENDIAN
+#if PIPE_ARCH_BIG_ENDIAN
size_t i, e;
assert(n % 4 == 0);