summaryrefslogtreecommitdiff
path: root/hw/intc/allwinner-a10-pic.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2015-03-23 15:29:27 +0000
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:08 +0200
commitbd2a88840e2496e29442f333c8fdd6491e831a35 (patch)
tree95ced0dfbbd8ac39d8e73b55a414398dccb106ad /hw/intc/allwinner-a10-pic.c
parent786a4ea82ec9c87e3a895cf41081029b285a5fe5 (diff)
Convert ffs() != 0 callers to ctz32()
There are a number of ffs(3) callers that do roughly: bit = ffs(val); if (bit) { do_something(bit - 1); } This pattern can be converted to ctz32() like this: zeroes = ctz32(val); if (zeroes != 32) { do_something(zeroes); } Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1427124571-28598-6-git-send-email-stefanha@redhat.com Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/intc/allwinner-a10-pic.c')
-rw-r--r--hw/intc/allwinner-a10-pic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c
index de820b9723..eed7621f13 100644
--- a/hw/intc/allwinner-a10-pic.c
+++ b/hw/intc/allwinner-a10-pic.c
@@ -23,7 +23,7 @@
static void aw_a10_pic_update(AwA10PICState *s)
{
uint8_t i;
- int irq = 0, fiq = 0, pending;
+ int irq = 0, fiq = 0, zeroes;
s->vector = 0;
@@ -32,9 +32,9 @@ static void aw_a10_pic_update(AwA10PICState *s)
fiq |= s->select[i] & s->irq_pending[i] & ~s->mask[i];
if (!s->vector) {
- pending = ffs(s->irq_pending[i] & ~s->mask[i]);
- if (pending) {
- s->vector = (i * 32 + pending - 1) * 4;
+ zeroes = ctz32(s->irq_pending[i] & ~s->mask[i]);
+ if (zeroes != 32) {
+ s->vector = (i * 32 + zeroes) * 4;
}
}
}