endian.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* $OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $ */
  2. /*-
  3. * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  15. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  16. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. /*
  26. * Generic definitions for little- and big-endian systems. Other endianesses
  27. * has to be dealt with in the specific machine/endian.h file for that port.
  28. *
  29. * This file is meant to be included from a little- or big-endian port's
  30. * machine/endian.h after setting _BYTE_ORDER to either 1234 for little endian
  31. * or 4321 for big..
  32. */
  33. #ifndef _SYS_ENDIAN_H_
  34. #define _SYS_ENDIAN_H_
  35. #define _LITTLE_ENDIAN 1234
  36. #define _BIG_ENDIAN 4321
  37. #define _PDP_ENDIAN 3412
  38. #define _BYTE_ORDER _LITTLE_ENDIAN
  39. #define LITTLE_ENDIAN _LITTLE_ENDIAN
  40. #define BIG_ENDIAN _BIG_ENDIAN
  41. #define PDP_ENDIAN _PDP_ENDIAN
  42. #define BYTE_ORDER _BYTE_ORDER
  43. #define __BYTE_ORDER _BYTE_ORDER
  44. #define __BIG_ENDIAN _BIG_ENDIAN
  45. #define __LITTLE_ENDIAN _LITTLE_ENDIAN
  46. #endif /* _SYS_ENDIAN_H_ */