Skip to content

Commit 9b78845

Browse files
committed
Verify that __BYTE_ORDER__ is defined before testing it
1 parent d172613 commit 9b78845

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/env.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace Napi;
1414

1515
#if defined (__linux)
1616
#include <endian.h> // For __BYTE_ORDER, __BIG_ENDIAN
17-
#if __BYTE_ORDER == __BIG_ENDIAN
17+
#if defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
1818
#define BE64_TO_HOST(x) (x)
1919
#else
2020
#define BE64_TO_HOST(x) bswap_64((x))

src/ordered-binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int compareFast(const MDB_val *a, const MDB_val *b) {
3434
bVal = *((uint8_t*) dataB);
3535
} else {
3636
aVal = ntohl(*dataA);
37-
#if __BYTE_ORDER == __BIG_ENDIAN
37+
#if defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
3838
bVal = remaining == 2 ? *dataB & 0xffff0000 : *dataB & 0xffffff00;
3939
#else
4040
bVal = remaining == 2 ? (*((uint8_t*) dataB) << 24) + (*((uint8_t*) dataB + 1) << 16) :

0 commit comments

Comments
 (0)