Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
720 B

  1. /*
  2. * Public domain
  3. * machine/endian.h compatibility shim
  4. */
  5. #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
  6. #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
  7. #if defined(_WIN32)
  8. #define LITTLE_ENDIAN 1234
  9. #define BIG_ENDIAN 4321
  10. #define PDP_ENDIAN 3412
  11. /*
  12. * Use GCC and Visual Studio compiler defines to determine endian.
  13. */
  14. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  15. #define BYTE_ORDER LITTLE_ENDIAN
  16. #else
  17. #define BYTE_ORDER BIG_ENDIAN
  18. #endif
  19. #elif defined(__linux__)
  20. #include <endian.h>
  21. #elif defined(__sun) || defined(_AIX) || defined(__hpux)
  22. #include <sys/types.h>
  23. #include <arpa/nameser_compat.h>
  24. #elif defined(__sgi)
  25. #include <standards.h>
  26. #include <sys/endian.h>
  27. #else
  28. #include_next <machine/endian.h>
  29. #endif
  30. #endif