On Thu, Aug 11, 2005 at 01:03:14AM +0200, Rene Herman wrote: > 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) IMO, one of them should be just "log2". -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/