Am 23.08.2011 15:21, schrieb Frediano Ziglio: > Signed-off-by: Frediano Ziglio <fredd...@gmail.com> > --- > 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; > }
Depending on whether the compiler is smart enough this will or will not change performance. However, even if we assume that it's a slight improvement, this is in a function that is hardly ever run and the optimisation comes with a high cost in terms of readability. I wouldn't do this. Kevin