diff options
author | Stefan Hajnoczi | 2015-03-23 16:29:26 +0100 |
---|---|---|
committer | Kevin Wolf | 2015-04-28 15:36:08 +0200 |
commit | 786a4ea82ec9c87e3a895cf41081029b285a5fe5 (patch) | |
tree | fe42f1059c13ea9a27bc9515e5d440d3bb354773 /hw/display/tc6393xb.c | |
parent | uninorth: convert ffs(3) to ctz32() (diff) | |
download | qemu-786a4ea82ec9c87e3a895cf41081029b285a5fe5.tar.gz qemu-786a4ea82ec9c87e3a895cf41081029b285a5fe5.tar.xz qemu-786a4ea82ec9c87e3a895cf41081029b285a5fe5.zip |
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/display/tc6393xb.c')
-rw-r--r-- | hw/display/tc6393xb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 4306adc959..66b7ade8da 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -171,7 +171,7 @@ static void tc6393xb_gpio_handler_update(TC6393xbState *s) level = s->gpio_level & s->gpio_dir; for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) { - bit = ffs(diff) - 1; + bit = ctz32(diff); qemu_set_irq(s->handler[bit], (level >> bit) & 1); } |