From patchwork Thu Jul 23 11:08:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 51392 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 0724D20323 for ; Thu, 23 Jul 2015 11:09:13 +0000 (UTC) Received: by laef2 with SMTP id f2sf67411109lae.0 for ; Thu, 23 Jul 2015 04:09:12 -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=aEfl4wYyFYZGS4X5N4mzDCSg95YivmDO54tMwlkuMBEABjCMmRExQMI4rY6HEVg8C+ T57vaOc8fWX2MQaXCLjcERQSaUsYqMRkYC9Rm7RGO7bt5EPgYvF6RGXRDOM8rrfevw/2 w6d2Rf4UwmKp9EWo1YPTG1Zv1stFwxW8pvnHHC6DuM9Vqp34FfvRpeR+9Xm2Ge6UsxaE NbG5gFVZSIEqUzNqN/ED8uE/iOpzHPpV687vbm/KcYekN/+UPZcaHMWab9iXeswXmZjZ thOee33rUoxcO1W1q2iDGcGTUhxoyndVOfWJXKKK46tOSc6MOTfRVJjh3OPo+rYj9TZ+ ACYw== X-Gm-Message-State: ALoCoQn/iA5i1bO55O34p09stiwWKMBgWXKwb1/WbwpGQT49K0DszHTxKQBqzMS2snYYjfsJxqU1 X-Received: by 10.180.182.110 with SMTP id ed14mr3967314wic.5.1437649751988; Thu, 23 Jul 2015 04:09:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.74 with SMTP id k10ls221987laf.30.gmail; Thu, 23 Jul 2015 04:09:11 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr6523019laa.76.1437649751832; Thu, 23 Jul 2015 04:09:11 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id zv9si3895939lbb.117.2015.07.23.04.09.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 04:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lahh5 with SMTP id h5so155244600lah.2 for ; Thu, 23 Jul 2015 04:09:11 -0700 (PDT) X-Received: by 10.112.139.103 with SMTP id qx7mr7273282lbb.73.1437649751719; Thu, 23 Jul 2015 04:09:11 -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 l6csp486515lba; Thu, 23 Jul 2015 04:09:10 -0700 (PDT) X-Received: by 10.70.3.98 with SMTP id b2mr17376131pdb.107.1437649746663; Thu, 23 Jul 2015 04:09:06 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id u7si11286247pdl.135.2015.07.23.04.09.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Jul 2015 04:09:05 -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 ) id 1ZIEN0-0003cg-Kc; Thu, 23 Jul 2015 12:08:58 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini , Keith Busch , Kevin Wolf , "Michael S. Tsirkin" , qemu-block@nongnu.org Subject: [PATCH 4/5] exec.c: Use pow2floor() rather than hand-calculation Date: Thu, 23 Jul 2015 12:08:57 +0100 Message-Id: <1437649738-13885-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437649738-13885-1-git-send-email-peter.maydell@linaro.org> References: <1437649738-13885-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.51 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: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use pow2floor() to round down to the nearest power of 2, rather than an inline calculation. Signed-off-by: Peter Maydell --- 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); return l; }