Message ID | 1437741192-20955-5-git-send-email-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | 6554f5c03793bb8a3d5dedcebf758a1694fa186c |
Headers | show
Return-Path: <patchwork-forward+bncBC6Z756YVMIBBF7BZCWQKGQES5K3REA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id DF3A522D94 for <linaro@patches.linaro.org>; Fri, 24 Jul 2015 12:33:28 +0000 (UTC) Received: by lagw2 with SMTP id w2sf7070912lag.3 for <linaro@patches.linaro.org>; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=MKGSBaYseCZ+4TXR87tfl3nzjlToAUb3aA4Z5AKMsyw=; b=KvAuoHks5hMJ1OllQocd61WE5cKR2ewqoI3IUGvFnqobX8vjdtXQCaHCXSnelgedhd xhg4VVaKbT0gx5e/4mrVtsrpFAOY/nWRJ1Jv0LMLPEc7Y7hkWapU5Nvul8FXHh/TVniQ iv36e4i4ieXMGMKAD00o3i+o9vzgdzv6OlVYKu6jHOhREpWWXPfKOwFqzEsaCO3WFfSq klGCjziwmzhHooz7+9sNXIzmeFizgT2dMkSB87TeRVontobbWDeT3ym5KjwUp/kqmHrU 8A1Cp9Sf/h8Kr4DPXaKNyO8QucWALsolPRjODDZypurgVVrFyb6eSGoIYuuUkOfokVSc S7CA== X-Gm-Message-State: ALoCoQnlU4Zi1StykgWDODRBVzxSkXm6fR6vr/h+TLqKDR3q/6s6VaEm2g4wEznjYFXyV9OLBA93 X-Received: by 10.112.26.5 with SMTP id h5mr6205213lbg.4.1437741207952; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.73 with SMTP id k9ls353858lam.66.gmail; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) X-Received: by 10.112.201.199 with SMTP id kc7mr13564759lbc.25.1437741207686; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id qa7si7428582lbc.18.2015.07.24.05.33.27 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 05:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laah7 with SMTP id h7so13315889laa.0 for <patchwork-forward@linaro.org>; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) X-Received: by 10.113.4.105 with SMTP id cd9mr13498687lbd.106.1437741207602; Fri, 24 Jul 2015 05:33:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1150369lba; Fri, 24 Jul 2015 05:33:26 -0700 (PDT) X-Received: by 10.70.34.38 with SMTP id w6mr30736954pdi.147.1437741200787; Fri, 24 Jul 2015 05:33:20 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id i6si20421854pdr.64.2015.07.24.05.33.18 for <patches@linaro.org> (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 24 Jul 2015 05:33:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from <pm215@archaic.org.uk>) id 1ZIcA4-0005Si-UR; Fri, 24 Jul 2015 13:33:12 +0100 From: Peter Maydell <peter.maydell@linaro.org> To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini <pbonzini@redhat.com>, Keith Busch <keith.busch@intel.com>, Kevin Wolf <kwolf@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, qemu-block@nongnu.org Subject: [PATCH v2 4/6] exec.c: Use pow2floor() rather than hand-calculation Date: Fri, 24 Jul 2015 13:33:10 +0100 Message-Id: <1437741192-20955-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437741192-20955-1-git-send-email-peter.maydell@linaro.org> References: <1437741192-20955-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: <patchwork-forward.linaro.org> X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
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; }
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> --- exec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)