1 | /* Endian macros for string.h functions |
2 | Copyright (C) 1992-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ |
18 | |
19 | #ifndef _BITS_ENDIAN_H |
20 | #define _BITS_ENDIAN_H 1 |
21 | |
22 | /* Definitions for byte order, according to significance of bytes, |
23 | from low addresses to high addresses. The value is what you get by |
24 | putting '4' in the most significant byte, '3' in the second most |
25 | significant byte, '2' in the second least significant byte, and '1' |
26 | in the least significant byte, and then writing down one digit for |
27 | each byte, starting with the byte at the lowest address at the left, |
28 | and proceeding to the byte with the highest address at the right. */ |
29 | |
30 | #define __LITTLE_ENDIAN 1234 |
31 | #define __BIG_ENDIAN 4321 |
32 | #define __PDP_ENDIAN 3412 |
33 | |
34 | /* This file defines `__BYTE_ORDER' for the particular machine. */ |
35 | #include <bits/endianness.h> |
36 | |
37 | /* Some machines may need to use a different endianness for floating point |
38 | values. */ |
39 | #ifndef __FLOAT_WORD_ORDER |
40 | # define __FLOAT_WORD_ORDER __BYTE_ORDER |
41 | #endif |
42 | |
43 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
44 | # define __LONG_LONG_PAIR(HI, LO) LO, HI |
45 | #elif __BYTE_ORDER == __BIG_ENDIAN |
46 | # define __LONG_LONG_PAIR(HI, LO) HI, LO |
47 | #endif |
48 | |
49 | #endif /* bits/endian.h */ |
50 | |