qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows
Date: Mon,  8 Sep 2014 09:59:04 +1000	[thread overview]
Message-ID: <1410134344-30803-1-git-send-email-aik@ozlabs.ru> (raw)

This replaces gcc's ffsl() function ("find first bit set in a word")
with QEMU's ctzl ("count trailing zeros"). There are no corner cases
in the affected code so simple replacement ffsl()-1 by ctzl() works.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 4b20e36..2ab4460 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -705,8 +705,8 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
             hwaddr sizetmp = pow2floor(node_size);
 
             /* mem_start != 0 here */
-            if (ffsl(mem_start) < ffsl(sizetmp)) {
-                sizetmp = 1ULL << (ffsl(mem_start) - 1);
+            if (ctzl(mem_start) < ctzl(sizetmp)) {
+                sizetmp = 1ULL << ctzl(mem_start);
             }
 
             spapr_populate_memory_node(fdt, i, mem_start, sizetmp);
-- 
2.0.0

             reply	other threads:[~2014-09-07 23:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 23:59 Alexey Kardashevskiy [this message]
2014-09-08  3:03 ` [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows David Gibson
2014-09-08 10:50 ` Alexander Graf

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=1410134344-30803-1-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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;
as well as URLs for NNTP newsgroup(s).