mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Dipankar Sarma <dipankar@gamebox.net>,
	Petr Vandrovec <VANDROVE@vc.cvut.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [TRIVIAL] Re: UP went into unexpected trashing
Date: Sat, 09 Nov 2002 14:16:19 +1100	[thread overview]
Message-ID: <20021109041542.054AF2C0DF@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 08 Nov 2002 12:10:14 -0800." <Pine.LNX.4.44.0211081206140.4471-100000@penguin.transmeta.com>


In message <Pine.LNX.4.44.0211081206140.4471-100000@penguin.transmeta.com> you 
write:
> 
> On Sat, 9 Nov 2002, Dipankar Sarma wrote:
> > 
> > Or add a check in there. I can't figure out a way to avoid the extra 
> > conditional branch anyway :)
> 
> I'd actually rather change the calling convention, and say that the only 
> valid test is for testing the return value "being in range".

At least gcc 3.0 doesn't do the optimization for you, unfortunately 8(

So I agree, although I'd prefer the stricter definition.

Rusty.
PS.  Previous documentation was written by a bad monkey, so I've fixed
     it to actually say something useful, too.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5-bk/include/asm-i386/bitops.h working-2.5-bk-find_first_bit/include/asm-i386/bitops.h
--- linux-2.5-bk/include/asm-i386/bitops.h	2002-11-09 13:33:20.000000000 +1100
+++ working-2.5-bk-find_first_bit/include/asm-i386/bitops.h	2002-11-09 14:12:32.000000000 +1100
@@ -263,10 +263,10 @@ static __inline__ int variable_test_bit(
 /**
  * find_first_zero_bit - find the first zero bit in a memory region
  * @addr: The address to start the search at
- * @size: The maximum size to search
+ * @size: The maximum size to search (may be rounded up by BITS_PER_LONG)
  *
- * Returns the bit-number of the first zero bit, not the number of the byte
- * containing a bit.
+ * Returns the bit-number of the first zero bit (not the number of the byte
+ * containing the bit) or a value >= size if none found.
  */
 static __inline__ int find_first_zero_bit(unsigned long * addr, unsigned size)
 {
@@ -295,10 +295,10 @@ static __inline__ int find_first_zero_bi
 /**
  * find_first_bit - find the first set bit in a memory region
  * @addr: The address to start the search at
- * @size: The maximum size to search
+ * @size: The maximum size to search (may be rounded up by BITS_PER_LONG)
  *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
+ * Returns the bit-number of the first set bit (not the number of the byte
+ * containing the bit) or a value >= size if none found.
  */
 static __inline__ int find_first_bit(unsigned long * addr, unsigned size)
 {
@@ -321,10 +321,14 @@ static __inline__ int find_first_bit(uns
 }
 
 /**
- * find_next_zero_bit - find the first zero bit in a memory region
+ * find_next_zero_bit - find the next zero bit in a memory region
  * @addr: The address to base the search on
  * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
+ * @size: The maximum size to search (may be rounded up by BITS_PER_LONG)
+ * 
+ * Returns the bit-number of the first zero bit >= offset (not the
+ * number of the byte containing the bit), or a value >= size if none
+ * found.
  */
 static __inline__ int find_next_zero_bit(unsigned long * addr, int size, int offset)
 {
@@ -354,10 +358,14 @@ static __inline__ int find_next_zero_bit
 }
 
 /**
- * find_next_bit - find the first set bit in a memory region
+ * find_next_bit - find the next set bit in a memory region
  * @addr: The address to base the search on
  * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
+ * @size: The maximum size to search (may be rounded up by BITS_PER_LONG)
+ * 
+ * Returns the bit-number of the first bit set >= offset (not the
+ * number of the byte containing the bit) or a value >= size if none
+ * found.
  */
 static __inline__ int find_next_bit(unsigned long *addr, int size, int offset)
 {

  reply	other threads:[~2002-11-09  4:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 14:35 Petr Vandrovec
2002-11-08 19:53 ` Dipankar Sarma
2002-11-08 20:10   ` Linus Torvalds
2002-11-09  3:16     ` Rusty Russell [this message]
2002-11-09  4:40       ` Linus Torvalds
2002-11-10  3:09         ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2002-11-08  8:33 Rusty Trivial Russell

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=20021109041542.054AF2C0DF@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=VANDROVE@vc.cvut.cz \
    --cc=dipankar@gamebox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®