From: Rene Herman <rene.herman@keyaccess.nl>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] Re: Log2 all through the kernel?
Date: Wed, 10 Aug 2005 23:03:14 +0000 [thread overview]
Message-ID: <42FA87B2.1020406@keyaccess.nl> (raw)
In-Reply-To: <1123689284.5437.10.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Erik Mouw wrote:
> On Wed, Aug 10, 2005 at 05:54:44PM +0200, Oliver Korpilla wrote:
>
>>Wouldn't it be more sensible to supply one portable one, with bit
>>shifts, and people with a need for O(1) timing could implement it using
>>an array?
>
>
> Send a patch to the linux-kernel mailing list and see what happens.
Sticking a few defines in a header somewhere should do, I believe:
#define floor_log2(x) (fls(x) - 1)
#define ceil_log2(x) (fls((x) - 1)
fls() is both defined in the kernel and a gcc builtin.
Rene.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2005-08-10 23:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-10 15:54 [KJ] Re: Log2 all through the kernel? Oliver Korpilla
2005-08-10 20:26 ` Erik Mouw
2005-08-10 23:03 ` Rene Herman [this message]
2005-08-11 3:42 ` Alexey Dobriyan
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=42FA87B2.1020406@keyaccess.nl \
--to=rene.herman@keyaccess.nl \
--cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.