From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQmMi-0006dR-7M for qemu-devel@nongnu.org; Sun, 07 Sep 2014 19:59:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQmMW-0000t7-Dx for qemu-devel@nongnu.org; Sun, 07 Sep 2014 19:59:28 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:57825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQmMV-0000st-PR for qemu-devel@nongnu.org; Sun, 07 Sep 2014 19:59:16 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Sep 2014 09:59:10 +1000 From: Alexey Kardashevskiy Date: Mon, 8 Sep 2014 09:59:04 +1000 Message-Id: <1410134344-30803-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH] spapr: Fix spapr_populate_memory() to compile on windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, 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 --- 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