浏览代码

misc/byteorder.h: verify byte order info

ambrop7 14 年之前
父节点
当前提交
5f7c96481c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      misc/byteorder.h

+ 4 - 0
misc/byteorder.h

@@ -32,6 +32,10 @@
 #ifndef BADVPN_MISC_BYTEORDER_H
 #define BADVPN_MISC_BYTEORDER_H
 
+#if (defined(BADVPN_LITTLE_ENDIAN) + defined(BADVPN_BIG_ENDIAN)) != 1
+#error Unknown byte order or too many byte orders
+#endif
+
 #include <stdint.h>
 
 static uint16_t badvpn_reverse16 (uint16_t x)