diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-07-05 16:49:29 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-07-05 16:49:29 +0200 |
commit | caf1cbff16919ffb27016f80f6691c91d771b44f (patch) | |
tree | 32ea68b8a29c8860b4dfdc25c6a0a1b8d07f857c /src/include | |
parent | 7799411a8401be5eb85f622f6a923614831cd731 (diff) | |
download | gnunet-caf1cbff16919ffb27016f80f6691c91d771b44f.tar.gz gnunet-caf1cbff16919ffb27016f80f6691c91d771b44f.zip |
- do not include in platform
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_common.h | 19 | ||||
-rw-r--r-- | src/include/platform.h | 19 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 7477ca4c8..1126deaf4 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -143,6 +143,25 @@ enum GNUNET_GenericReturnValue | |||
143 | */ | 143 | */ |
144 | 144 | ||
145 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 145 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
146 | #if defined(__linux__) | ||
147 | #define BYTE_SWAP_16(x) __bswap_16 (x) | ||
148 | #define BYTE_SWAP_32(x) __bswap_32 (x) | ||
149 | #define BYTE_SWAP_64(x) __bswap_64 (x) | ||
150 | #else | ||
151 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) | ||
152 | |||
153 | #define BYTE_SWAP_32(x) \ | ||
154 | ((((x) & 0x000000ffU) << 24) | (((x) & 0x0000ff00U) << 8) \ | ||
155 | | (((x) & 0x00ff0000U) >> 8) | (((x) & 0xff000000U) >> 24)) | ||
156 | |||
157 | #define BYTE_SWAP_64(x) \ | ||
158 | ((((x) & 0x00000000000000ffUL) << 56) | (((x) & 0x000000000000ff00UL) << 40) \ | ||
159 | | (((x) & 0x0000000000ff0000UL) << 24) | (((x) & 0x00000000ff000000UL) << 8) \ | ||
160 | | (((x) & 0x000000ff00000000UL) >> 8) | (((x) & 0x0000ff0000000000UL) >> 24) \ | ||
161 | | (((x) & 0x00ff000000000000UL) >> 40) | (((x) & 0xff00000000000000UL) >> \ | ||
162 | 56)) | ||
163 | #endif | ||
164 | |||
146 | #define GNUNET_htobe16(x) BYTE_SWAP_16 (x) | 165 | #define GNUNET_htobe16(x) BYTE_SWAP_16 (x) |
147 | #define GNUNET_htole16(x) (x) | 166 | #define GNUNET_htole16(x) (x) |
148 | #define GNUNET_be16toh(x) BYTE_SWAP_16 (x) | 167 | #define GNUNET_be16toh(x) BYTE_SWAP_16 (x) |
diff --git a/src/include/platform.h b/src/include/platform.h index da70893a7..e641b38eb 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -199,25 +199,6 @@ | |||
199 | #undef HAVE_MREMAP | 199 | #undef HAVE_MREMAP |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | #if defined(__linux__) | ||
203 | #define BYTE_SWAP_16(x) __bswap_16 (x) | ||
204 | #define BYTE_SWAP_32(x) __bswap_32 (x) | ||
205 | #define BYTE_SWAP_64(x) __bswap_64 (x) | ||
206 | #else | ||
207 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) | ||
208 | |||
209 | #define BYTE_SWAP_32(x) \ | ||
210 | ((((x) & 0x000000ffU) << 24) | (((x) & 0x0000ff00U) << 8) \ | ||
211 | | (((x) & 0x00ff0000U) >> 8) | (((x) & 0xff000000U) >> 24)) | ||
212 | |||
213 | #define BYTE_SWAP_64(x) \ | ||
214 | ((((x) & 0x00000000000000ffUL) << 56) | (((x) & 0x000000000000ff00UL) << 40) \ | ||
215 | | (((x) & 0x0000000000ff0000UL) << 24) | (((x) & 0x00000000ff000000UL) << 8) \ | ||
216 | | (((x) & 0x000000ff00000000UL) >> 8) | (((x) & 0x0000ff0000000000UL) >> 24) \ | ||
217 | | (((x) & 0x00ff000000000000UL) >> 40) | (((x) & 0xff00000000000000UL) >> \ | ||
218 | 56)) | ||
219 | #endif | ||
220 | |||
221 | #if ! HAVE_ATOLL | 202 | #if ! HAVE_ATOLL |
222 | long long | 203 | long long |
223 | atoll (const char *nptr); | 204 | atoll (const char *nptr); |