diff --git a/ChangeLog b/ChangeLog index 059d27f0a4..6d86a07d79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-06-14 Ulrich Drepper + + [BZ #10229] + * misc/sys/select.h (__NFDBITS): Expression should have type int. + * sysdeps/x86_64/bits/select.h: Remove asm versions for __FD_SET, + __FD_CLR, and __FD_ISSET. gcc nowadays generates better code from + the C version. + 2009-06-12 Ulrich Drepper * Versions.def: Add GLIBC_2.11 for libpthread. diff --git a/misc/sys/select.h b/misc/sys/select.h index 2a408433ec..f4a37be551 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -1,5 +1,5 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996,97,98,99,2000,01,02,2003 Free Software Foundation, Inc. + Copyright (C) 1996-2003, 2009 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 @@ -59,7 +59,7 @@ typedef long int __fd_mask; #undef __FDELT #undef __FDMASK /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ -#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __NFDBITS (8 * (int) sizeof (__fd_mask)) #define __FDELT(d) ((d) / __NFDBITS) #define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) diff --git a/sysdeps/x86_64/bits/select.h b/sysdeps/x86_64/bits/select.h index 7f23cb59b1..5f31b84080 100644 --- a/sysdeps/x86_64/bits/select.h +++ b/sysdeps/x86_64/bits/select.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2001, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2001,2008,2009 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 @@ -27,14 +27,8 @@ # if __WORDSIZE == 64 # define __FD_ZERO_STOS "stosq" -# define __FD_SET_BTS "btsq" -# define __FD_CLR_BTR "btrq" -# define __FD_ISSET_BT "btq" # else # define __FD_ZERO_STOS "stosl" -# define __FD_SET_BTS "btsl" -# define __FD_CLR_BTR "btrl" -# define __FD_ISSET_BT "btl" # endif # define __FD_ZERO(fdsp) \ @@ -48,26 +42,6 @@ : "memory"); \ } while (0) -# define __FD_SET(fd, fdsp) \ - __asm__ __volatile__ (__FD_SET_BTS " %1,%0" \ - : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ - : "r" (((int) (fd)) % __NFDBITS) \ - : "cc","memory") -# define __FD_CLR(fd, fdsp) \ - __asm__ __volatile__ (__FD_CLR_BTR " %1,%0" \ - : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ - : "r" (((int) (fd)) % __NFDBITS) \ - : "cc","memory") -# define __FD_ISSET(fd, fdsp) \ - (__extension__ \ - ({register char __result; \ - __asm__ __volatile__ (__FD_ISSET_BT " %1,%2 ; setcb %b0" \ - : "=q" (__result) \ - : "r" (((int) (fd)) % __NFDBITS), \ - "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ - : "cc"); \ - __result; })) - #else /* ! GNU CC */ /* We don't use `memset' because this would require a prototype and @@ -79,8 +53,10 @@ for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ __FDS_BITS (__arr)[__i] = 0; \ } while (0) -# define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d)) -# define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)) -# define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) #endif /* GNU CC */ + +#define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d)) +#define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)) +#define __FD_ISSET(d, set) \ + ((__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) != 0)