From patchwork Tue Aug 23 13:21:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 111108 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 CB5DCB7321 for ; Tue, 23 Aug 2011 23:23:22 +1000 (EST) Received: from localhost ([::1]:50786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvqwp-0004js-AX for incoming@patchwork.ozlabs.org; Tue, 23 Aug 2011 09:23:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqwS-00040A-Ag for qemu-devel@nongnu.org; Tue, 23 Aug 2011 09:23:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvqwQ-0007Ne-GC for qemu-devel@nongnu.org; Tue, 23 Aug 2011 09:22:56 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:43513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqwQ-0007K6-DX for qemu-devel@nongnu.org; Tue, 23 Aug 2011 09:22:54 -0400 Received: by mail-gy0-f173.google.com with SMTP id 12so88079gyd.4 for ; Tue, 23 Aug 2011 06:22:49 -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=st6Ke1z5NILUT0x2tRYOPzqloxyyAOqROgj+qxoLhhY=; b=Ft9hKxerRo+0H2EcpKsQKoRyccYNt6hgBW+fgkqobNXIL6Fuuq3vHyudcyLNl1DIqg Lk++/L/qk1gKT5eDOx7NOtZo/B0iMHjzfzrN5GNW6cCEbBksSJvHTOlcc3ED6waakgEQ BD6o/d7GWOA5RLBJVwX5PLNqYoInwKi2ojsJw= Received: by 10.236.161.167 with SMTP id w27mr23350342yhk.1.1314105769118; Tue, 23 Aug 2011 06:22:49 -0700 (PDT) Received: from obol602.omnitel.it (tor-exit-router37-readme.formlessnetworking.net [199.48.147.37]) by mx.google.com with ESMTPS id a29sm227805yhj.3.2011.08.23.06.22.42 (version=SSLv3 cipher=OTHER); Tue, 23 Aug 2011 06:22:48 -0700 (PDT) From: Frediano Ziglio To: kwolf@redhat.com Date: Tue, 23 Aug 2011 15:21:21 +0200 Message-Id: <1314105682-28396-15-git-send-email-freddy77@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1314105682-28396-1-git-send-email-freddy77@gmail.com> References: <1314105682-28396-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.160.173 Cc: qemu-devel@nongnu.org, Frediano Ziglio Subject: [Qemu-devel] [PATCH v3 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 2a915be..0f9a64a 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)) == 0; } /*