qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows
@ 2014-09-07 23:59 Alexey Kardashevskiy
  2014-09-08  3:03 ` David Gibson
  2014-09-08 10:50 ` Alexander Graf
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Kardashevskiy @ 2014-09-07 23:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

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

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

end of thread, other threads:[~2014-09-08 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07 23:59 [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows Alexey Kardashevskiy
2014-09-08  3:03 ` David Gibson
2014-09-08 10:50 ` Alexander Graf

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).