aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/bits
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-12 02:02:20 +0000
committerRoland McGrath <roland@gnu.org>2002-08-12 02:02:20 +0000
commit7a8bdff02c8bc80d5068eadf83302595d11f46d4 (patch)
tree4f55261ddbc4238511bf0a8f3a0d935407e56609 /sysdeps/i386/bits
parenta83f1ae4c84302888c9fee52502dff8e8bdac4e5 (diff)
downloadglibc-7a8bdff02c8bc80d5068eadf83302595d11f46d4.tar
glibc-7a8bdff02c8bc80d5068eadf83302595d11f46d4.tar.gz
glibc-7a8bdff02c8bc80d5068eadf83302595d11f46d4.tar.bz2
glibc-7a8bdff02c8bc80d5068eadf83302595d11f46d4.zip
* sunrpc/svc_authux.c (_svcauth_unix): Remove spurious printf (ugh!).
* sysdeps/i386/bits/byteswap.h (__bswap_16, __bswap_32, __bswap_64): Evaluate argument exactly once. Remove __volatile__ from asm's. * include/unistd.h: Use libc_hidden_proto for getdomainname and getlogin_r. * sysdeps/generic/getdomain.c: Add libc_hidden_def. * sysdeps/mach/hurd/getdomain.c: Likewise. * sysdeps/unix/getlogin_r.c: Likewise. * sysdeps/mach/hurd/getlogin_r.c: Likewise. * sysdeps/generic/getlogin_r.c: Likewise. * include/rpc/auth_des.h: Use libc_hidden_proto for rtime. * sunrpc/rtime.c: Add libc_hidden_def. * include/string.h: Use libc_hidden_proto for basename. * string/basename.c [_LIBC]: Add libc_hidden_def. * sysdeps/unix/sysv/linux/opensock.c (__opensock): socket -> __socket. * locale/loadarchive.c: munmap -> __munmap throughout. * include/netdb.h: Use libc_hidden_proto for gai_strerror. * sysdeps/posix/gai_strerror.c: Add libc_hidden_def. * sysdeps/generic/gai_strerror.c: Likewise.
Diffstat (limited to 'sysdeps/i386/bits')
-rw-r--r--sysdeps/i386/bits/byteswap.h58
1 files changed, 30 insertions, 28 deletions
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index d08a342ab7..6812c61e4d 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -31,18 +31,20 @@
#if defined __GNUC__ && __GNUC__ >= 2
# define __bswap_16(x) \
(__extension__ \
- ({ register unsigned short int __v; \
- if (__builtin_constant_p (x)) \
- __v = __bswap_constant_16 (x); \
+ ({ register unsigned short int __v, __x = (x); \
+ if (__builtin_constant_p (__x)) \
+ __v = __bswap_constant_16 (__x); \
else \
- __asm__ __volatile__ ("rorw $8, %w0" \
- : "=r" (__v) \
- : "0" ((unsigned short int) (x)) \
- : "cc"); \
+ __asm__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
__v; }))
#else
/* This is better than nothing. */
-# define __bswap_16(x) __bswap_constant_16 (x)
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
#endif
@@ -55,33 +57,33 @@
/* To swap the bytes in a word the i486 processors and up provide the
`bswap' opcode. On i386 we have to use three instructions. */
# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
-# define __bswap_32(x) \
+# define __bswap_32(x) \
(__extension__ \
- ({ register unsigned int __v; \
- if (__builtin_constant_p (x)) \
- __v = __bswap_constant_32 (x); \
+ ({ register unsigned int __v, __x = (x); \
+ if (__builtin_constant_p (__x)) \
+ __v = __bswap_constant_32 (__x); \
else \
- __asm__ __volatile__ ("rorw $8, %w0;" \
- "rorl $16, %0;" \
- "rorw $8, %w0" \
- : "=r" (__v) \
- : "0" ((unsigned int) (x)) \
- : "cc"); \
+ __asm__ ("rorw $8, %w0;" \
+ "rorl $16, %0;" \
+ "rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
__v; }))
# else
# define __bswap_32(x) \
(__extension__ \
- ({ register unsigned int __v; \
- if (__builtin_constant_p (x)) \
- __v = __bswap_constant_32 (x); \
+ ({ register unsigned int __v, __x = (x); \
+ if (__builtin_constant_p (__x)) \
+ __v = __bswap_constant_32 (__x); \
else \
- __asm__ __volatile__ ("bswap %0" \
- : "=r" (__v) \
- : "0" ((unsigned int) (x))); \
+ __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); \
__v; }))
# endif
#else
-# define __bswap_32(x) __bswap_constant_32 (x)
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned int __x = (x); __bswap_constant_32 (__x); }))
#endif
@@ -101,11 +103,11 @@
(__extension__ \
({ union { __extension__ unsigned long long int __ll; \
unsigned long int __l[2]; } __w, __r; \
- if (__builtin_constant_p (x)) \
- __r.__ll = __bswap_constant_64 (x); \
+ __w.__ll = (x); \
+ if (__builtin_constant_p (__w.__ll)) \
+ __r.__ll = __bswap_constant_64 (__w.__ll); \
else \
{ \
- __w.__ll = (x); \
__r.__l[0] = __bswap_32 (__w.__l[1]); \
__r.__l[1] = __bswap_32 (__w.__l[0]); \
} \