Skip to content

Commit

Permalink
Fix endianess detection
Browse files Browse the repository at this point in the history
  • Loading branch information
wtdcode committed Nov 16, 2022
1 parent 5f5ef15 commit e9c1c17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
UC_DIR = SRC_DIR if os.path.exists(SRC_DIR) else os.path.join(ROOT_DIR, '../..')
BUILD_DIR = os.path.join(UC_DIR, 'build_python')

VERSION = "2.0.1"
VERSION = "2.0.1.post1"

if SYSTEM == 'darwin':
LIBRARY_FILE = "libunicorn.2.dylib"
Expand Down
19 changes: 14 additions & 5 deletions tests/unit/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
# elif (__BYTE_ORDER == __PDP_ENDIAN)
# define BOOST_PDP_ENDIAN
# else
# error Unknown machine endianness detected.
// Failsafe
# define BOOST_LITTLE_ENDIAN
# endif
# define BOOST_BYTE_ORDER __BYTE_ORDER
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
Expand All @@ -50,11 +51,14 @@
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234
// https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/Predefined-macros
#elif defined(__sparc) || defined(__sparc__) \
|| defined(_POWER) || defined(__powerpc__) \
|| defined(__ppc__) || defined(__hpux) || defined(__hppa) \
|| defined(_MIPSEB) || defined(_POWER) \
|| defined(__s390__)
|| defined(__s390__) \
|| defined(__ARMEB__) || defined(__AARCH64EB__) \
|| defined(__BIG_ENDIAN) || defined(__ARM_BIG_ENDIAN)
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
#elif defined(__i386__) || defined(__alpha__) \
Expand All @@ -63,12 +67,17 @@
|| defined(_M_ALPHA) || defined(__amd64) \
|| defined(__amd64__) || defined(_M_AMD64) \
|| defined(__x86_64) || defined(__x86_64__) \
|| defined(_M_X64) || defined(__bfin__)

|| defined(_M_X64) || defined(__bfin__) \
|| defined(__ARMEL__) || defined(__AARCH64EL__) \
|| defined(__arm64__) || defined(__arm__)
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234
#else
# error The file boost/detail/endian.hpp needs to be set up for your CPU type.

// Failsafe
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234

#endif


Expand Down

0 comments on commit e9c1c17

Please sign in to comment.