1b8e80941Smrg/**************************************************************************
2b8e80941Smrg *
3b8e80941Smrg * Copyright 2007-2008 VMware, Inc.
4b8e80941Smrg * All Rights Reserved.
5b8e80941Smrg *
6b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7b8e80941Smrg * copy of this software and associated documentation files (the
8b8e80941Smrg * "Software"), to deal in the Software without restriction, including
9b8e80941Smrg * without limitation the rights to use, copy, modify, merge, publish,
10b8e80941Smrg * distribute, sub license, and/or sell copies of the Software, and to
11b8e80941Smrg * permit persons to whom the Software is furnished to do so, subject to
12b8e80941Smrg * the following conditions:
13b8e80941Smrg *
14b8e80941Smrg * The above copyright notice and this permission notice (including the
15b8e80941Smrg * next paragraph) shall be included in all copies or substantial portions
16b8e80941Smrg * of the Software.
17b8e80941Smrg *
18b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19b8e80941Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20b8e80941Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21b8e80941Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22b8e80941Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23b8e80941Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24b8e80941Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25b8e80941Smrg *
26b8e80941Smrg **************************************************************************/
27b8e80941Smrg#ifndef U_ENDIAN_H
28b8e80941Smrg#define U_ENDIAN_H
29b8e80941Smrg
30b8e80941Smrg#ifdef HAVE_ENDIAN_H
31b8e80941Smrg#include <endian.h>
32b8e80941Smrg
33b8e80941Smrg#if __BYTE_ORDER == __LITTLE_ENDIAN
34b8e80941Smrg# define PIPE_ARCH_LITTLE_ENDIAN
35b8e80941Smrg#elif __BYTE_ORDER == __BIG_ENDIAN
36b8e80941Smrg# define PIPE_ARCH_BIG_ENDIAN
37b8e80941Smrg#endif
38b8e80941Smrg
39b8e80941Smrg#elif defined(__APPLE__)
40b8e80941Smrg#include <machine/endian.h>
41b8e80941Smrg
42b8e80941Smrg#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
43b8e80941Smrg# define PIPE_ARCH_LITTLE_ENDIAN
44b8e80941Smrg#elif __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
45b8e80941Smrg# define PIPE_ARCH_BIG_ENDIAN
46b8e80941Smrg#endif
47b8e80941Smrg
48b8e80941Smrg#elif defined(__sun)
49b8e80941Smrg#include <sys/isa_defs.h>
50b8e80941Smrg
51b8e80941Smrg#if defined(_LITTLE_ENDIAN)
52b8e80941Smrg# define PIPE_ARCH_LITTLE_ENDIAN
53b8e80941Smrg#elif defined(_BIG_ENDIAN)
54b8e80941Smrg# define PIPE_ARCH_BIG_ENDIAN
55b8e80941Smrg#endif
56b8e80941Smrg
57b8e80941Smrg#elif defined(__OpenBSD__) || defined(__NetBSD__) || \
58b8e80941Smrg      defined(__FreeBSD__) || defined(__DragonFly__)
59b8e80941Smrg#include <sys/types.h>
60b8e80941Smrg#include <machine/endian.h>
61b8e80941Smrg
62b8e80941Smrg#if _BYTE_ORDER == _LITTLE_ENDIAN
63b8e80941Smrg# define PIPE_ARCH_LITTLE_ENDIAN
64b8e80941Smrg#elif _BYTE_ORDER == _BIG_ENDIAN
65b8e80941Smrg# define PIPE_ARCH_BIG_ENDIAN
66b8e80941Smrg#endif
67b8e80941Smrg
68b8e80941Smrg#elif defined(_MSC_VER)
69b8e80941Smrg
70b8e80941Smrg#define PIPE_ARCH_LITTLE_ENDIAN
71b8e80941Smrg
72b8e80941Smrg#endif
73b8e80941Smrg
74b8e80941Smrg#endif
75