[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/6] exec.c: Use pow2floor() rather than hand
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/6] exec.c: Use pow2floor() rather than hand-calculation |
Date: |
Sat, 15 Aug 2015 01:41:39 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 24/07/2015 14:33, Peter Maydell wrote:
> 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);
Reviewed-by: Paolo Bonzini <address@hidden>
> return l;
> }
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v2 4/6] exec.c: Use pow2floor() rather than hand-calculation,
Paolo Bonzini <=