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

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

Backports commit 6554f5c03793bb8a3d5dedcebf758a1694fa186c from qemu
This commit is contained in:
Peter Maydell 2018-02-15 11:09:26 -05:00 committed by Lioncash
parent 9ce672c511
commit 400fd62ba7
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1653,9 +1653,7 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
if (l > access_size_max) { if (l > access_size_max) {
l = access_size_max; l = access_size_max;
} }
if (l & (l - 1)) { l = pow2floor(l);
l = 1 << (qemu_fls(l) - 1);
}
return l; return l;
} }