LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* where to simplify code using is_power_of_2() function
@ 2009-04-24 13:55 Robert P. J. Day
  0 siblings, 0 replies; only message in thread
From: Robert P. J. Day @ 2009-04-24 13:55 UTC (permalink / raw)
  To: Linux PPC Mailing List


  just an observation that you can aesthetically simplify some ppc
code using the boolean is_power_of_2() routine from
include/linux/log2.h if you were so inclined:

arch/powerpc/sysdev/ppc4xx_pci.c:171:	if ((size & (size - 1)) != 0  ||
arch/powerpc/mm/ppc_mmu_32.c:216:	if (n_hpteg & (n_hpteg - 1)) {
arch/powerpc/boot/cuboot-pq2.c:176:	if (mem->size[1] & (mem->size[1] - 1))
arch/powerpc/boot/cuboot-pq2.c:178:	if (io->size[1] & (io->size[1] - 1))
arch/powerpc/lib/rheap.c:258:	if ((alignment & (alignment - 1)) != 0)
arch/powerpc/lib/rheap.c:307:	if ((alignment & (alignment - 1)) != 0)
arch/powerpc/lib/rheap.c:450:	if (size <= 0 || (alignment & (alignment - 1)) != 0)

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-24 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24 13:55 where to simplify code using is_power_of_2() function Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox