aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/common.h b/common.h
index 7eab3b9..dce817a 100644
--- a/common.h
+++ b/common.h
@@ -52,9 +52,37 @@
# define HAS_BUILTIN(X) 0
#endif
-#if defined(__x86_64__) || defined(__i386__)
-# define LITTLE_ENDIAN
-#else
+#ifndef LIBBLAKE_ENDIAN_KNOWN__
+# if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
+# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+# define LITTLE_ENDIAN
+# define LIBBLAKE_ENDIAN_KNOWN__
+# endif
+# endif
+#endif
+#ifndef LIBBLAKE_ENDIAN_KNOWN__
+# if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define BIG_ENDIAN
+# define LIBBLAKE_ENDIAN_KNOWN__
+# endif
+# endif
+#endif
+#ifndef LIBBLAKE_ENDIAN_KNOWN__
+# if defined(__BYTE_ORDER__) && defined(__ORDER_PDP_ENDIAN__)
+# if __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
+# define PDP_ENDIAN
+# define LIBBLAKE_ENDIAN_KNOWN__
+# endif
+# endif
+#endif
+#ifndef LIBBLAKE_ENDIAN_KNOWN__
+# if defined(__x86_64__) || defined(__i386__)
+# define LITTLE_ENDIAN
+# define LIBBLAKE_ENDIAN_KNOWN__
+# endif
+#endif
+#ifndef LIBBLAKE_ENDIAN_KNOWN__
# error Endian is unknown
#endif