util/u_endian: Add error checks
authorDylan Baker <dylan@pnwbakers.com>
Thu, 24 Oct 2019 17:16:15 +0000 (10:16 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Tue, 5 Nov 2019 16:39:55 +0000 (16:39 +0000)
As suggested by Eric Engestrom and Michel Dänzer.

src/util/u_endian.h

index 4e4ba60ca1da308926974f58d2689f965e2de2c4..fb3eda42c5cdcc325dda77ebc22e4599a358de81 100644 (file)
 
 #endif
 
+#if !defined(UTIL_ARCH_LITTLE_ENDIAN) || !defined(UTIL_ARCH_BIG_ENDIAN)
+# error "UTIL_ARCH_LITTLE_ENDIAN and/or UTIL_ARCH_BIG_ENDIAN were unset."
+#elif UTIL_ARCH_LITTLE_ENDIAN == UTIL_ARCH_BIG_ENDIAN
+# error "UTIL_ARCH_LITTLE_ENDIAN and UTIL_ARCH_BIG_ENDIAN must not both be 1 or 0."
+#endif
+
 #endif