]> Git Repo - qemu.git/commitdiff
uninorth: convert ffs(3) to ctz32()
authorStefan Hajnoczi <[email protected]>
Mon, 23 Mar 2015 15:29:25 +0000 (15:29 +0000)
committerKevin Wolf <[email protected]>
Tue, 28 Apr 2015 13:36:08 +0000 (15:36 +0200)
It is not clear from the code how a 0 parameter should be handled by the
hardware.  Keep the same behavior as ffs(0) - 1 == -1.

Cc: Alexander Graf <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-id: 1427124571[email protected]
Signed-off-by: Kevin Wolf <[email protected]>
hw/pci-host/uninorth.c

index 53f2b59ae84f7fb8cd48086dc3c8979dc7d85b52..f0144eb7b01e29fddd23e82753ecdfbc1ed4a9f0 100644 (file)
@@ -92,7 +92,10 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
         uint32_t slot, func;
 
         /* Grab CFA0 style values */
-        slot = ffs(reg & 0xfffff800) - 1;
+        slot = ctz32(reg & 0xfffff800);
+        if (slot == 32) {
+            slot = -1; /* XXX: should this be 0? */
+        }
         func = (reg >> 8) & 7;
 
         /* ... and then convert them to x86 format */
This page took 0.022611 seconds and 4 git commands to generate.