endian.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Bernhard Walle <bernhard@bwalle.de>, 2012
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  12. * the GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * Comatibility with BSD-like userland.
  19. */
  20. #ifndef ENDIAN_H_
  21. #define ENDIAN_H_
  22. #ifdef __linux__
  23. #include_next <endian.h>
  24. #elif __APPLE__
  25. #include <machine/endian.h>
  26. #ifndef __DARWIN_BYTE_ORDER
  27. #error "No __DARWIN_BYTE_ORDER defined"
  28. #endif
  29. #define __BYTE_ORDER __DARWIN_BYTE_ORDER
  30. #define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
  31. #define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
  32. #else
  33. #error "No byteswap.h found"
  34. #endif
  35. #endif /* ENDIAN_H_ */