Skip to content

Commit e9c1c17

Browse files
committed
Fix endianess detection
1 parent 5f5ef15 commit e9c1c17

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

bindings/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
UC_DIR = SRC_DIR if os.path.exists(SRC_DIR) else os.path.join(ROOT_DIR, '../..')
3030
BUILD_DIR = os.path.join(UC_DIR, 'build_python')
3131

32-
VERSION = "2.0.1"
32+
VERSION = "2.0.1.post1"
3333

3434
if SYSTEM == 'darwin':
3535
LIBRARY_FILE = "libunicorn.2.dylib"

tests/unit/endian.h

+14-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
# elif (__BYTE_ORDER == __PDP_ENDIAN)
4242
# define BOOST_PDP_ENDIAN
4343
# else
44-
# error Unknown machine endianness detected.
44+
// Failsafe
45+
# define BOOST_LITTLE_ENDIAN
4546
# endif
4647
# define BOOST_BYTE_ORDER __BYTE_ORDER
4748
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
@@ -50,11 +51,14 @@
5051
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
5152
# define BOOST_LITTLE_ENDIAN
5253
# define BOOST_BYTE_ORDER 1234
54+
// https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/Predefined-macros
5355
#elif defined(__sparc) || defined(__sparc__) \
5456
|| defined(_POWER) || defined(__powerpc__) \
5557
|| defined(__ppc__) || defined(__hpux) || defined(__hppa) \
5658
|| defined(_MIPSEB) || defined(_POWER) \
57-
|| defined(__s390__)
59+
|| defined(__s390__) \
60+
|| defined(__ARMEB__) || defined(__AARCH64EB__) \
61+
|| defined(__BIG_ENDIAN) || defined(__ARM_BIG_ENDIAN)
5862
# define BOOST_BIG_ENDIAN
5963
# define BOOST_BYTE_ORDER 4321
6064
#elif defined(__i386__) || defined(__alpha__) \
@@ -63,12 +67,17 @@
6367
|| defined(_M_ALPHA) || defined(__amd64) \
6468
|| defined(__amd64__) || defined(_M_AMD64) \
6569
|| defined(__x86_64) || defined(__x86_64__) \
66-
|| defined(_M_X64) || defined(__bfin__)
67-
70+
|| defined(_M_X64) || defined(__bfin__) \
71+
|| defined(__ARMEL__) || defined(__AARCH64EL__) \
72+
|| defined(__arm64__) || defined(__arm__)
6873
# define BOOST_LITTLE_ENDIAN
6974
# define BOOST_BYTE_ORDER 1234
7075
#else
71-
# error The file boost/detail/endian.hpp needs to be set up for your CPU type.
76+
77+
// Failsafe
78+
# define BOOST_LITTLE_ENDIAN
79+
# define BOOST_BYTE_ORDER 1234
80+
7281
#endif
7382

7483

0 commit comments

Comments
 (0)