#pragma once /* Portable be64toh() for non-glibc or pre-2.25 targets. */ #if defined(__linux__) # include #elif defined(__APPLE__) # include # include # define be64toh(x) OSSwapBigToHostInt64(x) #else # include static inline uint64_t be64toh(uint64_t x) { # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ return __builtin_bswap64(x); # else return x; # endif } #endif