All of lore.kernel.org
 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

* Re: [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows
  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
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2014-09-08  3:03 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel, Alexander Graf

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

On Mon, Sep 08, 2014 at 09:59:04AM +1000, Alexey Kardashevskiy wrote:
> 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>

Looks sane to me.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2014-09-08 10:50 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel; +Cc: qemu-ppc



On 08.09.14 01:59, Alexey Kardashevskiy wrote:
> 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>

Thanks, squashed into "spapr: Split memory nodes to power-of-two blocks".


Alex

^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.