where to simplify code using is_power_of_2() function

Robert P. J. Day rpjday at crashcourse.ca
Fri Apr 24 23:55:06 EST 2009


  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
========================================================================



More information about the Linuxppc-dev mailing list