aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-07-24 13:33:10 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-09-07 14:19:00 +0100
commit6554f5c03793bb8a3d5dedcebf758a1694fa186c (patch)
tree3a88b2862a1dd6454fbd4a82cd376fd05c3392e0 /exec.c
parent26efcec158a87133bb6255ae7d3127a5fa6e66fd (diff)
downloadqemu-6554f5c03793bb8a3d5dedcebf758a1694fa186c.zip
qemu-6554f5c03793bb8a3d5dedcebf758a1694fa186c.tar.gz
qemu-6554f5c03793bb8a3d5dedcebf758a1694fa186c.tar.bz2
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 <peter.maydell@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1437741192-20955-5-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index 54cd70a..31d2dc7 100644
--- a/exec.c
+++ b/exec.c
@@ -2374,9 +2374,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;
}