about summary refs log tree commit diff
path: root/sysdeps/i386/bits/byteswap.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-08 00:22:00 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-08 00:22:00 +0000
commitb5facfdac0a9a10f9b0b145d6e3b1348a751f2ff (patch)
treeba1c715765882bf6dad329e73ee45d99c152422e /sysdeps/i386/bits/byteswap.h
parente9c7764ec9fe328dfac0c01a7f609d6a2a9bac00 (diff)
downloadglibc-b5facfdac0a9a10f9b0b145d6e3b1348a751f2ff.tar.gz
glibc-b5facfdac0a9a10f9b0b145d6e3b1348a751f2ff.tar.xz
glibc-b5facfdac0a9a10f9b0b145d6e3b1348a751f2ff.zip
Update.
2003-01-06  Philip Blundell  <philb@gnu.org>

	* sysdeps/unix/arm/sysdep.S (syscall_error): Optimise a little.
	[__LIBC_REENTRANT]: Unify PIC and non-PIC cases.

	* sysdeps/unix/sysv/linux/arm/sysdep.h (PSEUDO): Remove .type
	directive.
	(PSEUDO_RET): Use SYSCALL_ERROR in place of __syscall_error.
	(SYSCALL_ERROR): New.
	(SYSCALL_ERROR_HANDLER) [NOT_IN_libc]: Provide local copy of error
	handling code.
	(INTERNAL_SYSCALL): Define.
	(INLINE_SYSCALL): Use it.
	(INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Define.
	* sysdeps/unix/sysv/linux/arm/socket.S (__socket): Use
	SYSCALL_ERROR in place of __syscall_error.

2003-01-07  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ia64/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16,
	__bswap_32, __bswap_64): Put x into temporary variable
	to avoid warnings.
	[!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static
	(inline) functions.
	* sysdeps/s390/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16,
	__bswap_32, __bswap_64): Put x into temporary variable
	to avoid warnings.
	[!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static
	(inline) functions.
	* sysdeps/i386/bits/byteswap.h [!__GNUC__] (__bswap_16, __bswap_32):
	Likewise.

2003-01-07  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/alpha/adjtime.c (ntp_adjtime): New weak
	alias.
Diffstat (limited to 'sysdeps/i386/bits/byteswap.h')
-rw-r--r--sysdeps/i386/bits/byteswap.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index db8b15d4d3..0d7d75cb42 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -28,8 +28,9 @@
 #define __bswap_constant_16(x) \
      ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
 
-#if defined __GNUC__ && __GNUC__ >= 2
-# define __bswap_16(x) \
+#ifdef __GNUC__
+# if __GNUC__ >= 2
+#  define __bswap_16(x) \
      (__extension__							      \
       ({ register unsigned short int __v, __x = (x);			      \
 	 if (__builtin_constant_p (__x))				      \
@@ -40,24 +41,31 @@
  		    : "0" (__x)						      \
  		    : "cc");						      \
 	 __v; }))
-#else
+# else
 /* This is better than nothing.  */
-# define __bswap_16(x) \
+#  define __bswap_16(x) \
      (__extension__							      \
       ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
+# endif
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+  return __bswap_constant_16 (__bsx);
+}
 #endif
 
-
 /* Swap bytes in 32 bit value.  */
 #define __bswap_constant_32(x) \
      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |		      \
       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 
-#if defined __GNUC__ && __GNUC__ >= 2
+#ifdef __GNUC__
+# if __GNUC__ >= 2
 /* 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)							      \
+#  if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
+#   define __bswap_32(x)						      \
      (__extension__							      \
       ({ register unsigned int __v, __x = (x);				      \
 	 if (__builtin_constant_p (__x))				      \
@@ -70,8 +78,8 @@
 		    : "0" (__x)						      \
 		    : "cc");						      \
 	 __v; }))
-# else
-#  define __bswap_32(x) \
+#  else
+#   define __bswap_32(x) \
      (__extension__							      \
       ({ register unsigned int __v, __x = (x);				      \
 	 if (__builtin_constant_p (__x))				      \
@@ -79,11 +87,18 @@
 	 else								      \
 	   __asm__ ("bswap %0" : "=r" (__v) : "0" (__x));		      \
 	 __v; }))
-# endif
-#else
-# define __bswap_32(x) \
+#  endif
+# else
+#  define __bswap_32(x) \
      (__extension__							      \
       ({ register unsigned int __x = (x); __bswap_constant_32 (__x); }))
+# endif
+#else
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+  return __bswap_constant_32 (__bsx);
+}
 #endif