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