summaryrefslogtreecommitdiff
path: root/hw/pci-host
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2015-03-23 15:29:26 +0000
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:08 +0200
commit786a4ea82ec9c87e3a895cf41081029b285a5fe5 (patch)
treefe42f1059c13ea9a27bc9515e5d440d3bb354773 /hw/pci-host
parent5863d374a32c98a7adb4c5e49d62de3cdc16d2ea (diff)
Convert (ffs(val) - 1) to ctz32(val)
This commit was generated mechanically by coccinelle from the following semantic patch: @@ expression val; @@ - (ffs(val) - 1) + ctz32(val) The call sites have been audited to ensure the ffs(0) - 1 == -1 case never occurs (due to input validation, asserts, etc). Therefore we don't need to worry about the fact that ctz32(0) == 32. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1427124571-28598-5-git-send-email-stefanha@redhat.com Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/pci-host')
-rw-r--r--hw/pci-host/bonito.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 8134d0bcd0..3a731fe18d 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -427,7 +427,7 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr)
cfgaddr |= (s->regs[BONITO_PCIMAP_CFG] & 0xffff) << 16;
idsel = (cfgaddr & BONITO_PCICONF_IDSEL_MASK) >> BONITO_PCICONF_IDSEL_OFFSET;
- devno = ffs(idsel) - 1;
+ devno = ctz32(idsel);
funno = (cfgaddr & BONITO_PCICONF_FUN_MASK) >> BONITO_PCICONF_FUN_OFFSET;
regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET;