LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Linux PPC Mailing List <linuxppc-dev@ozlabs.org>
Subject: where to simplify code using is_power_of_2() function
Date: Fri, 24 Apr 2009 09:55:06 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0904240953120.17180@localhost.localdomain> (raw)


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

                 reply	other threads:[~2009-04-24 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0904240953120.17180@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox