public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arch@vger.kernel.org
Subject: Re: fcntl error
Date: Fri, 19 Mar 2004 09:38:52 +0000	[thread overview]
Message-ID: <9592.1079689132@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0403180923190.880@ppc970.osdl.org>


Linus Torvalds <torvalds@osdl.org> wrote:
> That implies that while non-zero for "set" is ok, that non-zero had better
> have the _low_ bits set. Which is not true on architectures that use just
> a logical and with the bits in the word.
> 
> Which implies that FD_ISSET() really must NOT be of that "logical and" 
> approach, which in turn implies that it should be either a inequality 
> expression, or it should be a "shift down and then and with 1".

Or maybe:

#define	__FD_ISSET(d, set)	(!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))

Which is probably better than a shift and bit-and. That then leaves it up to
the compiler as to whether the generation of 0 or 1 is actually necessary
(which if isn't if it's just the condition in an if-statement).

Or even:

#define FD_ISSET(fd,fdsetp)	(!!__FD_ISSET(fd,fdsetp))

Which would then apply to all arch's regardless.

David

      parent reply	other threads:[~2004-03-19  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 16:44 fcntl error David Howells
2004-03-18 17:30 ` Linus Torvalds
2004-03-18 17:47   ` Andreas Schwab
2004-03-19  9:38   ` David Howells [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9592.1079689132@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox