diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-05-16 10:49:07 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-05-16 11:29:48 -0400 |
commit | 7cd9d40ee0666963334fca7ae44cae2f779cd4cc (patch) | |
tree | dc188a48a9f6fd76e193b12ed90bf552ee439357 | |
parent | fe472f30e1b82f762993cbc5376ff9b25c605aa9 (diff) | |
download | bfs-7cd9d40ee0666963334fca7ae44cae2f779cd4cc.tar.xz |
trie: Use ENDIAN_* and bswap()
-rw-r--r-- | src/trie.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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 |