From: Peter Maydell Date: Fri, 24 Jul 2015 12:33:10 +0000 (+0100) Subject: exec.c: Use pow2floor() rather than hand-calculation X-Git-Tag: v2.5.0-rc0~148 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6554f5c03793bb8a3d5dedcebf758a1694fa186c;p=thirdparty%2Fqemu.git 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 Reviewed-by: Paolo Bonzini Message-id: 1437741192-20955-5-git-send-email-peter.maydell@linaro.org --- diff --git a/exec.c b/exec.c index 54cd70ac1e0..31d2dc79bce 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; }