qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 9bff5d: hw/pci: Use pow2ceil() rather than ha


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 9bff5d: hw/pci: Use pow2ceil() rather than hand-calculatio...
Date: Mon, 07 Sep 2015 08:30:04 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 9bff5d8135fc3f37932d4177727d293aa93ce79b
      
https://github.com/qemu/qemu/commit/9bff5d8135fc3f37932d4177727d293aa93ce79b
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M hw/pci/msix.c
    M hw/pci/pci.c

  Log Message:
  -----------
  hw/pci: Use pow2ceil() rather than hand-calculation

A couple of places in hw/pci use an inline calculation to round a
size up to the next largest power of 2. We have a utility routine
for this, so use it.

(The behaviour of the old code is different if the size value
is 0 -- it would leave it as 0 rather than rounding up to 1,
but in both cases we know the size can't be 0.
In the case where the size value had bit 31 set, the old code
would invoke undefined behaviour; the new code will give a
result of 0. Presumably that could never happen either.)

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Message-id: address@hidden


  Commit: 1d0148fe6c121b21476ac1ba5120f8990e7fe6cd
      
https://github.com/qemu/qemu/commit/1d0148fe6c121b21476ac1ba5120f8990e7fe6cd
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M hw/virtio/virtio-pci.c

  Log Message:
  -----------
  hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation

Use the utility function pow2ceil() for rounding up to the next
largest power of 2, rather than inline calculation.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Message-id: address@hidden


  Commit: 26efcec158a87133bb6255ae7d3127a5fa6e66fd
      
https://github.com/qemu/qemu/commit/26efcec158a87133bb6255ae7d3127a5fa6e66fd
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M hw/block/nvme.c

  Log Message:
  -----------
  hw/block/nvme.c: Use pow2ceil() rather than hand-calculation

Use pow2ceil() to round up to the next power of 2, rather
than an inline calculation.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden


  Commit: 6554f5c03793bb8a3d5dedcebf758a1694fa186c
      
https://github.com/qemu/qemu/commit/6554f5c03793bb8a3d5dedcebf758a1694fa186c
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M exec.c

  Log Message:
  -----------
  exec.c: Use pow2floor() rather than hand-calculation

Use pow2floor() to round down to the nearest power of 2,
rather than an inline calculation.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden


  Commit: 10944a19209bb520054569e0f156f50338901264
      
https://github.com/qemu/qemu/commit/10944a19209bb520054569e0f156f50338901264
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M include/qemu-common.h
    M util/cutils.c

  Log Message:
  -----------
  Remove unused qemu_fls function

Nothing uses qemu_fls() any more, so delete it.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden


  Commit: 8f1ed5f5081416d5d1cc9569aa826114c5b21213
      
https://github.com/qemu/qemu/commit/8f1ed5f5081416d5d1cc9569aa826114c5b21213
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-07 (Mon, 07 Sep 2015)

  Changed paths:
    M include/qemu-common.h
    M include/qemu/host-utils.h
    M util/cutils.c

  Log Message:
  -----------
  Make pow2ceil() and pow2floor() inline

Since the pow2floor() function is now used in a hot code path,
make it inline; for consistency, provide pow2ceil() as an inline
function too.

Because these functions use ctz64() we have to put the inline
versions into host-utils.h, so they have access to ctz64(),
and move the inline is_power_of_2() along with them.

We then need to include host-utils.h from qemu-common.h so that
the files which use these functions via qemu-common.h still have
access to them.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden


Compare: https://github.com/qemu/qemu/compare/4169198617dc...8f1ed5f50814

reply via email to

[Prev in Thread] Current Thread [Next in Thread]