[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 4/5] exec.c: Use pow2floor() rather than hand-calcul
From: |
Peter Maydell |
Subject: |
[Qemu-block] [PATCH 4/5] exec.c: Use pow2floor() rather than hand-calculation |
Date: |
Thu, 23 Jul 2015 12:08:57 +0100 |
Use pow2floor() to round down to the nearest power of 2,
rather than an inline calculation.
Signed-off-by: Peter Maydell <address@hidden>
---
exec.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/exec.c b/exec.c
index 7d60e15..4710e2d 100644
--- a/exec.c
+++ b/exec.c
@@ -2371,9 +2371,7 @@ static int memory_access_size(MemoryRegion *mr, unsigned
l, hwaddr addr)
if (l > access_size_max) {
l = access_size_max;
}
- if (l & (l - 1)) {
- l = 1 << (qemu_fls(l) - 1);
- }
+ l = pow2floor(l);
return l;
}
--
1.9.1
- [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor(), Peter Maydell, 2015/07/23
- [Qemu-block] [PATCH 3/5] hw/block/nvme.c: Use pow2ceil() rather than hand-calculation, Peter Maydell, 2015/07/23
- Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor(), Paolo Bonzini, 2015/07/23
- [Qemu-block] [PATCH 4/5] exec.c: Use pow2floor() rather than hand-calculation,
Peter Maydell <=
- [Qemu-block] [PATCH 5/5] Remove unused qemu_fls function, Peter Maydell, 2015/07/23
- [Qemu-block] [PATCH 2/5] hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation, Peter Maydell, 2015/07/23
- [Qemu-block] [PATCH 1/5] hw/pci: Use pow2ceil() rather than hand-calculation, Peter Maydell, 2015/07/23
- Re: [Qemu-block] [PATCH 0/5] replace qemu_fls() with pow2ceil()/pow2floor(), Paolo Bonzini, 2015/07/23