xref: /xnu-8792.81.2/bsd/arm/endian.h (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions /*
2*19c3b8c2SApple OSS Distributions  * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3*19c3b8c2SApple OSS Distributions  */
4*19c3b8c2SApple OSS Distributions /*
5*19c3b8c2SApple OSS Distributions  * Copyright 1995 NeXT Computer, Inc. All rights reserved.
6*19c3b8c2SApple OSS Distributions  */
7*19c3b8c2SApple OSS Distributions /*
8*19c3b8c2SApple OSS Distributions  * Copyright (c) 1987, 1991, 1993
9*19c3b8c2SApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
10*19c3b8c2SApple OSS Distributions  *
11*19c3b8c2SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
12*19c3b8c2SApple OSS Distributions  * modification, are permitted provided that the following conditions
13*19c3b8c2SApple OSS Distributions  * are met:
14*19c3b8c2SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
15*19c3b8c2SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
16*19c3b8c2SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
17*19c3b8c2SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
18*19c3b8c2SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
19*19c3b8c2SApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
20*19c3b8c2SApple OSS Distributions  *    must display the following acknowledgement:
21*19c3b8c2SApple OSS Distributions  *	This product includes software developed by the University of
22*19c3b8c2SApple OSS Distributions  *	California, Berkeley and its contributors.
23*19c3b8c2SApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
24*19c3b8c2SApple OSS Distributions  *    may be used to endorse or promote products derived from this software
25*19c3b8c2SApple OSS Distributions  *    without specific prior written permission.
26*19c3b8c2SApple OSS Distributions  *
27*19c3b8c2SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28*19c3b8c2SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29*19c3b8c2SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30*19c3b8c2SApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31*19c3b8c2SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32*19c3b8c2SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33*19c3b8c2SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34*19c3b8c2SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35*19c3b8c2SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36*19c3b8c2SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37*19c3b8c2SApple OSS Distributions  * SUCH DAMAGE.
38*19c3b8c2SApple OSS Distributions  *
39*19c3b8c2SApple OSS Distributions  *	@(#)endian.h	8.1 (Berkeley) 6/11/93
40*19c3b8c2SApple OSS Distributions  */
41*19c3b8c2SApple OSS Distributions 
42*19c3b8c2SApple OSS Distributions #ifndef _ARM__ENDIAN_H_
43*19c3b8c2SApple OSS Distributions #define _ARM__ENDIAN_H_
44*19c3b8c2SApple OSS Distributions 
45*19c3b8c2SApple OSS Distributions #if defined (__arm__) || defined (__arm64__)
46*19c3b8c2SApple OSS Distributions 
47*19c3b8c2SApple OSS Distributions #include <sys/cdefs.h>
48*19c3b8c2SApple OSS Distributions /*
49*19c3b8c2SApple OSS Distributions  * Define _NOQUAD if the compiler does NOT support 64-bit integers.
50*19c3b8c2SApple OSS Distributions  */
51*19c3b8c2SApple OSS Distributions /* #define _NOQUAD */
52*19c3b8c2SApple OSS Distributions 
53*19c3b8c2SApple OSS Distributions /*
54*19c3b8c2SApple OSS Distributions  * Define the order of 32-bit words in 64-bit words.
55*19c3b8c2SApple OSS Distributions  */
56*19c3b8c2SApple OSS Distributions #define _QUAD_HIGHWORD 1
57*19c3b8c2SApple OSS Distributions #define _QUAD_LOWWORD 0
58*19c3b8c2SApple OSS Distributions 
59*19c3b8c2SApple OSS Distributions /*
60*19c3b8c2SApple OSS Distributions  * Definitions for byte order, according to byte significance from low
61*19c3b8c2SApple OSS Distributions  * address to high.
62*19c3b8c2SApple OSS Distributions  */
63*19c3b8c2SApple OSS Distributions #define __DARWIN_LITTLE_ENDIAN  1234    /* LSB first: i386, vax */
64*19c3b8c2SApple OSS Distributions #define __DARWIN_BIG_ENDIAN     4321    /* MSB first: 68000, ibm, net */
65*19c3b8c2SApple OSS Distributions #define __DARWIN_PDP_ENDIAN     3412    /* LSB first in word, MSW first in long */
66*19c3b8c2SApple OSS Distributions 
67*19c3b8c2SApple OSS Distributions #define __DARWIN_BYTE_ORDER     __DARWIN_LITTLE_ENDIAN
68*19c3b8c2SApple OSS Distributions 
69*19c3b8c2SApple OSS Distributions #if     defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
70*19c3b8c2SApple OSS Distributions 
71*19c3b8c2SApple OSS Distributions #define LITTLE_ENDIAN   __DARWIN_LITTLE_ENDIAN
72*19c3b8c2SApple OSS Distributions #define BIG_ENDIAN      __DARWIN_BIG_ENDIAN
73*19c3b8c2SApple OSS Distributions #define PDP_ENDIAN      __DARWIN_PDP_ENDIAN
74*19c3b8c2SApple OSS Distributions 
75*19c3b8c2SApple OSS Distributions #define BYTE_ORDER      __DARWIN_BYTE_ORDER
76*19c3b8c2SApple OSS Distributions 
77*19c3b8c2SApple OSS Distributions #include <sys/_endian.h>
78*19c3b8c2SApple OSS Distributions 
79*19c3b8c2SApple OSS Distributions #endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
80*19c3b8c2SApple OSS Distributions #endif /* defined (__arm__) || defined (__arm64__) */
81*19c3b8c2SApple OSS Distributions #endif /* !_ARM__ENDIAN_H_ */
82