All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] another cleanup TO DO:  is_power_of_2() check
@ 2007-01-08 22:37 Robert P. J. Day
  2007-01-08 23:09 ` Frederik Deweerdt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert P. J. Day @ 2007-01-08 22:37 UTC (permalink / raw)
  To: kernel-janitors


  there are *numerous* places in the code that check if some value is
a power of 2 using the basic test "((x & (x - 1)) = 0)":

  $ grep -Er "(.*) ?\& ?\(\1 ?- ?1\)" .

as you can see, that test is all over the place.

  occasionally, someone decides to do the right thing and define a
macro:

  $ grep -r "#define is_power_of_2" .

i'm thinking it might be cleaner to define that macro in kernel.h and
clean up the source to use that macro, rather than constantly
rewriting that expression.

  thoughts?

rday
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-09  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 22:37 [KJ] another cleanup TO DO: is_power_of_2() check Robert P. J. Day
2007-01-08 23:09 ` Frederik Deweerdt
2007-01-08 23:15 ` Robert P. J. Day
2007-01-09  0:06 ` Frederik Deweerdt

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.