public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: P@draigBrady.com
To: Andrew Morton <akpm@osdl.org>
Cc: Nick Wilson <njw@osdl.org>,
	linux-kernel@vger.kernel.org, rddunlap@osdl.org
Subject: Re: [PATCH 0/6] add generic round_up_pow2() macro
Date: Fri, 08 Apr 2005 10:57:27 +0100	[thread overview]
Message-ID: <42565587.4000103@draigBrady.com> (raw)
In-Reply-To: <20050407175042.43c02ae9.akpm@osdl.org>

Andrew Morton wrote:
> Nick Wilson <njw@osdl.org> wrote:
> 
>>The first patch adds a generic round_up_pow2() macro to kernel.h. The
>> remaining patches modify a few files to make use of the new macro.
> 
> 
> We already have ALIGN() and roundup_pow_of_two().

cool. It doesn't handle x={0,1} though.
Maybe we should have:

static inline unsigned long __attribute_const__ 
__roundup_pow_of_two(unsigned long x)
{
         return (1UL << fls(x - 1));
}

static inline unsigned long __attribute_const__ 
roundup_pow_of_two(unsigned long x)
{
         return (unlikely(x<2)?2:__roundup_pow_of_two(x));
}

-- 
Pádraig Brady - http://www.pixelbeat.org
--

  reply	other threads:[~2005-04-08  9:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-08  0:44 [PATCH 0/6] add generic round_up_pow2() macro Nick Wilson
2005-04-08  0:48 ` [PATCH 1/6] include/linux/kernel.h: use " Nick Wilson
2005-04-08  0:49 ` [PATCH 2/6] " Nick Wilson
2005-04-08  0:50 ` [PATCH 3/6] include/linux/a.out.h: " Nick Wilson
2005-04-08  0:50 ` [PATCH 0/6] add " Andrew Morton
2005-04-08  9:57   ` P [this message]
2005-04-08 10:32     ` P
2005-04-08 18:50   ` [PATCH] Use ALIGN to remove duplicate code Nick Wilson
2005-04-08  0:50 ` [PATCH 4/6] kernel/resource.c: use generic round_up_pow2() macro Nick Wilson
2005-04-08  0:51 ` [PATCH 5/6] lib/bitmap.c: " Nick Wilson
2005-04-08  0:52 ` [PATCH 6/6] mm/bootmem.c: " Nick Wilson

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=42565587.4000103@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=njw@osdl.org \
    --cc=rddunlap@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