1 /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
23 /* Get the definitions of __*_ENDIAN, __BYTE_ORDER, and __FLOAT_WORD_ORDER. */
24 #include <bits/endian.h>
27 # define LITTLE_ENDIAN __LITTLE_ENDIAN
28 # define BIG_ENDIAN __BIG_ENDIAN
29 # define PDP_ENDIAN __PDP_ENDIAN
30 # define BYTE_ORDER __BYTE_ORDER
33 #if defined __USE_MISC && !defined __ASSEMBLER__
34 /* Conversion interfaces. */
35 # include <bits/byteswap.h>
36 # include <bits/uintn-identity.h>
38 # if __BYTE_ORDER == __LITTLE_ENDIAN
39 # define htobe16(x) __bswap_16 (x)
40 # define htole16(x) __uint16_identity (x)
41 # define be16toh(x) __bswap_16 (x)
42 # define le16toh(x) __uint16_identity (x)
44 # define htobe32(x) __bswap_32 (x)
45 # define htole32(x) __uint32_identity (x)
46 # define be32toh(x) __bswap_32 (x)
47 # define le32toh(x) __uint32_identity (x)
49 # define htobe64(x) __bswap_64 (x)
50 # define htole64(x) __uint64_identity (x)
51 # define be64toh(x) __bswap_64 (x)
52 # define le64toh(x) __uint64_identity (x)
55 # define htobe16(x) __uint16_identity (x)
56 # define htole16(x) __bswap_16 (x)
57 # define be16toh(x) __uint16_identity (x)
58 # define le16toh(x) __bswap_16 (x)
60 # define htobe32(x) __uint32_identity (x)
61 # define htole32(x) __bswap_32 (x)
62 # define be32toh(x) __uint32_identity (x)
63 # define le32toh(x) __bswap_32 (x)
65 # define htobe64(x) __uint64_identity (x)
66 # define htole64(x) __bswap_64 (x)
67 # define be64toh(x) __uint64_identity (x)
68 # define le64toh(x) __bswap_64 (x)