--- a/src/d_array.c
+++ b/src/d_array.c
@@ -504,11 +504,13 @@
 #include <sys/endian.h>
 #endif
 
-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) \
+    || defined(__OpenBSD__)
 #include <machine/endian.h>
 #endif
 
-#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(__ANDROID__)
+#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) \
+    || defined(__ANDROID__)
 #include <endian.h>
 #endif