Skip to content

Commit 4f2faf2

Browse files
authored
Add more ways to determine endianness (#12)
This is needed to compile for Apple Silicon (arm64) on macOS. Issue tracking macOS arm64 build: yugabyte/yugabyte-db#9984
1 parent 747c6e2 commit 4f2faf2

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/jenkins_hash.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@
5858

5959
# define JENKINS_LITTLE_ENDIAN
6060
# define JENKINS_BYTE_ORDER 1234
61+
// From https://stackoverflow.com/questions/4239993/determining-endianness-at-compile-time/4240029
62+
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
63+
defined(__BIG_ENDIAN__) || \
64+
defined(__ARMEB__) || \
65+
defined(__THUMBEB__) || \
66+
defined(__AARCH64EB__) || \
67+
defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
68+
# define JENKINS_BIG_ENDIAN
69+
# define JENKINS_BYTE_ORDER 4321
70+
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
71+
defined(__LITTLE_ENDIAN__) || \
72+
defined(__ARMEL__) || \
73+
defined(__THUMBEL__) || \
74+
defined(__AARCH64EL__) || \
75+
defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
76+
# define JENKINS_LITTLE_ENDIAN
77+
# define JENKINS_BYTE_ORDER 1234
6178
#else
6279
# error The file cassandra-cpp-driver/src/jenkins_hash.hpp needs to be set up for your CPU type.
6380
#endif

0 commit comments

Comments
 (0)