public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add the macro to test if "exactly_one_bit_set" to log2.h.
Date: Wed, 07 Nov 2007 11:17:12 +0200	[thread overview]
Message-ID: <47318298.2030903@panasas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0711061352520.29701@localhost.localdomain>

On Tue, Nov 06 2007 at 20:53 +0200, "Robert P. J. Day" <rpjday@crashcourse.ca> wrote:
> On Tue, 6 Nov 2007, Boaz Harrosh wrote:
> 
>> On Tue, Nov 06 2007 at 18:38 +0200, "Robert P. J. Day" <rpjday@crashcourse.ca> wrote:
>>> While this macro is defined in terms of "is_power_of_2" and is
>>> therefore functionally equivalent, the visual semantics are sometimes
>>> more appropriate for what is actually being tested.
>>>
>>> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
>>>
>>> ---
>>>
>>> diff --git a/include/linux/log2.h b/include/linux/log2.h
>>> index c8cf5e8..d0d324e 100644
>>> --- a/include/linux/log2.h
>>> +++ b/include/linux/log2.h
>>> @@ -55,6 +55,12 @@ bool is_power_of_2(unsigned long n)
>>>  }
>>>
>>>  /*
>>> + *  And for folks who want slightly different semantics ...
>>> + */
>>> +
>>> +#define exactly_one_bit_set is_power_of_2
>> at_most_one_bit_set No?
> 
> no, it really is *exactly* one bit set.  zero is not considered a
> power of two.
> 
> rday

Yes, Sorry for the noise it was late and I should have returned to
the kids instead of reading lkml.

Boaz

  reply	other threads:[~2007-11-07  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06 16:38 [PATCH] Add the macro to test if "exactly_one_bit_set" to log2.h Robert P. J. Day
2007-11-06 18:11 ` Boaz Harrosh
2007-11-06 18:53   ` Robert P. J. Day
2007-11-07  9:17     ` Boaz Harrosh [this message]
2007-11-09  4:36 ` Andrew Morton
2007-11-09  5:09   ` Robert P. J. Day

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=47318298.2030903@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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