[ASan] Add a few more malloc-related interceptors for Windows
[blocksruntime.git] / lib / int_endianness.h
blob70bd17730cb2463375bc3ff3b5dfff3462adde95
1 /* ===-- int_endianness.h - configuration header for compiler-rt ------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
10 * This file is a configuration header for compiler-rt.
11 * This file is not part of the interface of this library.
13 * ===----------------------------------------------------------------------===
16 #ifndef INT_ENDIANNESS_H
17 #define INT_ENDIANNESS_H
19 #if defined(__SVR4) && defined(__sun)
20 #include <sys/byteorder.h>
22 #if _BYTE_ORDER == _BIG_ENDIAN
23 #define _YUGA_LITTLE_ENDIAN 0
24 #define _YUGA_BIG_ENDIAN 1
25 #elif _BYTE_ORDER == _LITTLE_ENDIAN
26 #define _YUGA_LITTLE_ENDIAN 1
27 #define _YUGA_BIG_ENDIAN 0
28 #endif /* _BYTE_ORDER */
30 #endif /* Solaris and AuroraUX. */
32 /* .. */
34 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__minix)
35 #include <sys/endian.h>
37 #if _BYTE_ORDER == _BIG_ENDIAN
38 #define _YUGA_LITTLE_ENDIAN 0
39 #define _YUGA_BIG_ENDIAN 1
40 #elif _BYTE_ORDER == _LITTLE_ENDIAN
41 #define _YUGA_LITTLE_ENDIAN 1
42 #define _YUGA_BIG_ENDIAN 0
43 #endif /* _BYTE_ORDER */
45 #endif /* *BSD */
47 /* .. */
49 /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */
50 #if defined(__APPLE__) && defined(__MACH__) || defined(__ellcc__ )
52 #ifdef __BIG_ENDIAN__
53 #if __BIG_ENDIAN__
54 #define _YUGA_LITTLE_ENDIAN 0
55 #define _YUGA_BIG_ENDIAN 1
56 #endif
57 #endif /* __BIG_ENDIAN__ */
59 #ifdef __LITTLE_ENDIAN__
60 #if __LITTLE_ENDIAN__
61 #define _YUGA_LITTLE_ENDIAN 1
62 #define _YUGA_BIG_ENDIAN 0
63 #endif
64 #endif /* __LITTLE_ENDIAN__ */
66 #endif /* Mac OSX */
68 /* .. */
70 #if defined(__linux__)
71 #include <endian.h>
73 #if __BYTE_ORDER == __BIG_ENDIAN
74 #define _YUGA_LITTLE_ENDIAN 0
75 #define _YUGA_BIG_ENDIAN 1
76 #elif __BYTE_ORDER == __LITTLE_ENDIAN
77 #define _YUGA_LITTLE_ENDIAN 1
78 #define _YUGA_BIG_ENDIAN 0
79 #endif /* __BYTE_ORDER */
81 #endif /* GNU/Linux */
83 #if defined(_WIN32)
85 #define _YUGA_LITTLE_ENDIAN 1
86 #define _YUGA_BIG_ENDIAN 0
88 #endif /* Windows */
90 /* . */
92 #if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
93 #error Unable to determine endian
94 #endif /* Check we found an endianness correctly. */
96 #endif /* INT_ENDIANNESS_H */