summaryrefslogtreecommitdiffstats
path: root/src/trie.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-16 10:49:07 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-16 11:29:48 -0400
commit7cd9d40ee0666963334fca7ae44cae2f779cd4cc (patch)
treedc188a48a9f6fd76e193b12ed90bf552ee439357 /src/trie.c
parentfe472f30e1b82f762993cbc5376ff9b25c605aa9 (diff)
downloadbfs-7cd9d40ee0666963334fca7ae44cae2f779cd4cc.tar.xz
trie: Use ENDIAN_* and bswap()
Diffstat (limited to 'src/trie.c')
-rw-r--r--src/trie.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/trie.c b/src/trie.c
index becddbf..02d1ae9 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -367,14 +367,10 @@ static size_t trie_node_size(unsigned int size) {
return flex_sizeof(struct trie_node, children, size);
}
-#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#if ENDIAN_NATIVE == ENDIAN_LITTLE
# define TRIE_BSWAP(n) (n)
-#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-# if SIZE_WIDTH == 8
-# define TRIE_BSWAP(n) __builtin_bswap64(n)
-# elif SIZE_WIDTH == 4
-# define TRIE_BSWAP(n) __builtin_bswap32(n)
-# endif
+#elif ENDIAN_NATIVE == ENDIAN_BIG
+# define TRIE_BSWAP(n) bswap(n)
#endif
#ifdef TRIE_BSWAP