Skip to contentSkip to conversation

rounddown_pow_of_2 inclusion into log2.h

KJ vignesh babu 1 participant 1 message Aug 14, 2007 Kernel janitors

lore
Share & tools
lore
#0 lore raw

13 that i can identify as of now :)

Quoted 25 lines · Robert P. J. Day
Quoted 5 lines · vignesh babu

rday,

Any plans on including what Andrew Morton suggested in the near
future? Think you have had enough time to convince yourself ;)

if there's value in it, the following seems to work fine in terms of
rounding down to the nearest power of two.

static inline unsigned long
rounddown_pow_of_two(unsigned long n)

{
	return (n = 1) ? 0 : (1UL << ilog2(n));
}

args that are already a power of two will be unchanged, 1 will
clearly return 0, but an arg of zero should also be caught since that's undefined -- perhaps it should also return zero?

in any event, that routine seems to work fine. are there enough
places in the source tree to make this cleanup worth it?

rday

Signature · 12 lines
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"

_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon.
To resubscribe, send email to [email protected] with
&quot;subscribe kernel-janitors&quot; in message body and follow instructions.

Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors