summaryrefslogtreecommitdiff
path: root/bits/byteswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'bits/byteswap.h')
-rw-r--r--bits/byteswap.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/bits/byteswap.h b/bits/byteswap.h
index 3ca0ad6986..57d34b461a 100644
--- a/bits/byteswap.h
+++ b/bits/byteswap.h
@@ -1,5 +1,5 @@
/* Macros to swap the order of bytes in integer values.
- Copyright (C) 1997-2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
#define _BITS_BYTESWAP_H 1
#include <features.h>
+#include <bits/types.h>
/* Swap bytes in 16 bit value. */
#define __bswap_constant_16(x) \
@@ -38,7 +39,7 @@
(((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
#ifdef __GNUC__
-# if __GNUC_PREREQ (4, 2)
+# if __GNUC_PREREQ (4, 3)
static __inline unsigned int
__bswap_32 (unsigned int __bsx)
{
@@ -69,16 +70,16 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56)))
-# if __GNUC_PREREQ (4, 2)
-static __inline unsigned long long int
-__bswap_64 (unsigned long long int __bsx)
+# if __GNUC_PREREQ (4, 3)
+static __inline __uint64_t
+__bswap_64 (__uint64_t __bsx)
{
return __builtin_bswap64 (__bsx);
}
# else
# define __bswap_64(x) \
(__extension__ \
- ({ union { __extension__ unsigned long long int __ll; \
+ ({ union { __extension__ __uint64_t __ll; \
unsigned int __l[2]; } __w, __r; \
if (__builtin_constant_p (x)) \
__r.__ll = __bswap_constant_64 (x); \
@@ -90,7 +91,7 @@ __bswap_64 (unsigned long long int __bsx)
} \
__r.__ll; }))
# endif
-#elif __GLIBC_HAVE_LONG_LONG
+#else
# define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
@@ -101,8 +102,8 @@ __bswap_64 (unsigned long long int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
-static __inline unsigned long long int
-__bswap_64 (unsigned long long int __bsx)
+static __inline __uint64_t
+__bswap_64 (__uint64_t __bsx)
{
return __bswap_constant_64 (__bsx);
}