From patchwork Tue Aug 9 07:46:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 109168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A805B6F7A for ; Tue, 9 Aug 2011 18:43:05 +1000 (EST) Received: from localhost ([::1]:53022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqh2b-0006dV-4t for incoming@patchwork.ozlabs.org; Tue, 09 Aug 2011 03:47:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqh29-0005nE-Mp for qemu-devel@nongnu.org; Tue, 09 Aug 2011 03:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qqh28-00070o-Sc for qemu-devel@nongnu.org; Tue, 09 Aug 2011 03:47:29 -0400 Received: from mail-ey0-f171.google.com ([209.85.215.171]:43960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqh28-0006nW-27 for qemu-devel@nongnu.org; Tue, 09 Aug 2011 03:47:28 -0400 Received: by mail-ey0-f171.google.com with SMTP id 24so3371321eyg.16 for ; Tue, 09 Aug 2011 00:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=EIzSSCmABiiObOA4wGJJQNxcl+rFjwdRtbl2ZbDY72Y=; b=Wa8P0l1kEWum46/QVwIYcNolQMX9QjhNeQR6aX1K2Vi/utxcAV5Gw4ctFD/HTwB/1Q K3SH79LhyEaP/8cOvaHfQekE+h03Ztu7XQLlqwLuNjG2PvJ9V+EZ/Be8Q1S6n+EB1c5y 83I5MqnbSgccc1BIqVuNIRsvHuyVoHvCYCRcA= Received: by 10.213.3.155 with SMTP id 27mr1319442ebn.18.1312876047407; Tue, 09 Aug 2011 00:47:27 -0700 (PDT) Received: from obol602.omnitel.it ([206.217.137.183]) by mx.google.com with ESMTPS id p49sm2857459eef.58.2011.08.09.00.47.24 (version=SSLv3 cipher=OTHER); Tue, 09 Aug 2011 00:47:26 -0700 (PDT) From: Frediano Ziglio To: kwolf@redhat.com Date: Tue, 9 Aug 2011 09:46:49 +0200 Message-Id: <1312876010-15361-15-git-send-email-freddy77@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1312876010-15361-1-git-send-email-freddy77@gmail.com> References: <1312876010-15361-1-git-send-email-freddy77@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.215.171 Cc: qemu-devel@nongnu.org, Frediano Ziglio Subject: [Qemu-devel] [PATCH v2 14/15] qcow2: small math optimization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Frediano Ziglio --- block/qcow2-refcount.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 14b2f67..0e31868 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -140,10 +140,7 @@ static unsigned int next_refcount_table_size(BDRVQcowState *s, static int in_same_refcount_block(BDRVQcowState *s, uint64_t offset_a, uint64_t offset_b) { - uint64_t block_a = offset_a >> (2 * s->cluster_bits - REFCOUNT_SHIFT); - uint64_t block_b = offset_b >> (2 * s->cluster_bits - REFCOUNT_SHIFT); - - return (block_a == block_b); + return !((offset_a ^ offset_b) >> (2 * s->cluster_bits - REFCOUNT_SHIFT)); } /*