qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 14/15] qcow2: small math optimization


From: Frediano Ziglio
Subject: [Qemu-devel] [PATCH v3 14/15] qcow2: small math optimization
Date: Tue, 23 Aug 2011 15:21:21 +0200

Signed-off-by: Frediano Ziglio <address@hidden>
---
 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;
 }
 
 /*
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]