spapr: Fix spapr_populate_memory() to compile on windows
PATCH 1/1 spapr: Fix spapr_populate_memory() to compile on windows
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.
--- hw/ppc/spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +2 -2
@@ -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);
Signature · 1 line
2.0.0
Quoted 5 lines · Alexey Kardashevskiy
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 byctzl()works.Signed-off-by Alexey Kardashevskiy <[email protected]>
Looks sane to me.
Signature · 4 lines
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
Quoted 5 lines · Alexey Kardashevskiy
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 byctzl()works.Signed-off-by Alexey Kardashevskiy <[email protected]>
Thanks, squashed into "spapr: Split memory nodes to power-of-two blocks".
Alex