Add macos/freebsd missing endian.h include and add win endianness info
authorqiukeren <qiukeren@gmail.com>
Mon, 21 Dec 2015 12:52:40 +0000 (20:52 +0800)
committerest31 <MTest31@outlook.com>
Tue, 29 Dec 2015 22:03:30 +0000 (23:03 +0100)
src/util/serialize.h

index 58e59df224ce26c5a15aa44db07eab394214db6c..36324a6751e7dae9c4af3dae6eb09ac14a2b95a4 100644 (file)
@@ -26,7 +26,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "config.h"
 #if HAVE_ENDIAN_H
-       #include <endian.h>
+       #ifdef _WIN32
+               #define __BYTE_ORDER 0
+               #define __LITTLE_ENDIAN 0
+               #define __BIG_ENDIAN 1
+       #elif defined(__MACH__) && defined(__APPLE__)
+               #include <machine/endian.h>
+       #elif defined(__FreeBSD__)
+               #include <sys/endian.h>
+       #else
+               #include <endian.h>
+       #endif
 #endif
 #include <string.h> // for memcpy
 #include <iostream>