diff mbox

[v2,14/15] qcow2: small math optimization

Message ID 1312876010-15361-15-git-send-email-freddy77@gmail.com
State New
Headers show

Commit Message

Frediano Ziglio Aug. 9, 2011, 7:46 a.m. UTC
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
---
 block/qcow2-refcount.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
diff mbox

Patch

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));
 }
 
 /*