loci: fix byte swapping on OS X

The endian.h functions don't exist on OS X, so use the LOCI versions instead.
Also change the byte order macro used to one that's defined on both Linux and OS X.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 78a809e..fd6382b 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -731,7 +731,7 @@
 
 #define OF_MATCH_BYTES(length) (((length) + 7) & 0xfff8)
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN
 #define U16_NTOH(val) (val)
 #define U32_NTOH(val) (val)
 #define U64_NTOH(val) (val)