Convert ffs() != 0 callers to ctz32()
commitbd2a88840e2496e29442f333c8fdd6491e831a35
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 23 Mar 2015 15:29:27 +0000 (23 15:29 +0000)
committerKevin Wolf <kwolf@redhat.com>
Tue, 28 Apr 2015 13:36:08 +0000 (28 15:36 +0200)
tree95ced0dfbbd8ac39d8e73b55a414398dccb106ad
parent786a4ea82ec9c87e3a895cf41081029b285a5fe5
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>
hw/arm/omap1.c
hw/char/virtio-serial-bus.c
hw/gpio/omap_gpio.c
hw/i2c/omap_i2c.c
hw/intc/allwinner-a10-pic.c
kvm-all.c