byteswap.h 469 B

123456789101112131415161718192021222324
  1. #if defined(HAVE_BYTESWAP_H) && HAVE_BYTESWAP_H
  2. #include_next <byteswap.h>
  3. #else
  4. #include <inttypes.h>
  5. /* minimal version defining only the macros we need in our codebase */
  6. static inline uint16_t __bswap_16(uint16_t u)
  7. {
  8. return (uint16_t) __builtin_bswap16(u);
  9. }
  10. static inline uint32_t __bswap_32(uint32_t u)
  11. {
  12. return (uint32_t) __builtin_bswap32(u);
  13. }
  14. static inline uint64_t __bswap_64(uint64_t u)
  15. {
  16. return (uint64_t) __builtin_bswap64(u);
  17. }
  18. #endif