File tree 2 files changed +27
-22
lines changed
2 files changed +27
-22
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef KAITAI_ENDIAN_H
2
+ #define KAITAI_ENDIAN_H
3
+
4
+ #if defined(__APPLE__ )
5
+ #include <machine/endian.h>
6
+ #include <libkern/OSByteOrder.h>
7
+ #define bswap_16 (x ) OSSwapInt16(x)
8
+ #define bswap_32 (x ) OSSwapInt32(x)
9
+ #define bswap_64 (x ) OSSwapInt64(x)
10
+ #define __BIG_ENDIAN BIG_ENDIAN
11
+ #define __LITTLE_ENDIAN LITTLE_ENDIAN
12
+ #define __BYTE_ORDER BYTE_ORDER
13
+ #elif defined(_MSC_VER ) // !__APPLE__
14
+ #include <stdlib.h>
15
+ #define bswap_16 (x ) _byteswap_ushort(x)
16
+ #define bswap_32 (x ) _byteswap_ulong(x)
17
+ #define bswap_64 (x ) _byteswap_uint64(x)
18
+ #define __BIG_ENDIAN 4321
19
+ #define __LITTLE_ENDIAN 1234
20
+ #define __BYTE_ORDER __LITTLE_ENDIAN
21
+ #else // !__APPLE__ or !_MSC_VER
22
+ #include <endian.h>
23
+ #include <byteswap.h>
24
+ #endif
25
+
26
+ #endif
Original file line number Diff line number Diff line change 1
1
#include < kaitai/kistream.h>
2
-
3
- #if defined(__APPLE__)
4
- #include < machine/endian.h>
5
- #include < libkern/OSByteOrder.h>
6
- #define bswap_16 (x ) OSSwapInt16(x)
7
- #define bswap_32 (x ) OSSwapInt32(x)
8
- #define bswap_64 (x ) OSSwapInt64(x)
9
- #define __BYTE_ORDER BYTE_ORDER
10
- #define __BIG_ENDIAN BIG_ENDIAN
11
- #define __LITTLE_ENDIAN LITTLE_ENDIAN
12
- #elif defined(_MSC_VER) // !__APPLE__
13
- #include < stdlib.h>
14
- #define __LITTLE_ENDIAN 1234
15
- #define __BIG_ENDIAN 4321
16
- #define __BYTE_ORDER __LITTLE_ENDIAN
17
- #define bswap_16 (x ) _byteswap_ushort(x)
18
- #define bswap_32 (x ) _byteswap_ulong(x)
19
- #define bswap_64 (x ) _byteswap_uint64(x)
20
- #else // !__APPLE__ or !_MSC_VER
21
- #include < endian.h>
22
- #include < byteswap.h>
23
- #endif
2
+ #include < kaitai/endian.h>
24
3
25
4
#include < iostream>
26
5
#include < vector>
You can’t perform that action at this time.
0 commit comments