[Tarantool-patches] [PATCH] vclock: refactor vclock map to use type uint32_t

Serge Petrenko sergepetrenko at tarantool.org
Fri Mar 6 11:58:05 MSK 2020


Hi! Thanks for the review!

> 5 марта 2020 г., в 23:46, Vladislav Shpilevoy <v.shpilevoy at tarantool.org> написал(а):
> 
> Hi! Thanks for  the patch!
> 
> Consider this diff:
> 
> ====================
> diff --git a/src/box/vclock.h b/src/box/vclock.h
> index 9b499513a..a8549d2a9 100644
> --- a/src/box/vclock.h
> +++ b/src/box/vclock.h
> @@ -195,7 +195,7 @@ vclock_copy(struct vclock *dst, const struct vclock *src)
> static inline uint32_t
> vclock_size(const struct vclock *vclock)
> {
> -	return __builtin_popcount(vclock->map);
> +	return bit_count_u32(vclock->map);
> }

Ok. Also fixed for replica id filter size in a separate commit.

diff --git a/src/box/xrow.c b/src/box/xrow.c
index 602049004..5e3cb0709 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -1205,7 +1205,7 @@ xrow_encode_subscribe(struct xrow_header *row,
                return -1;
        }
        char *data = buf;
-       int filter_size = __builtin_popcount(id_filter);
+       int filter_size = bit_count_u32(id_filter);
        data = mp_encode_map(data, filter_size != 0 ? 6 : 5);
        data = mp_encode_uint(data, IPROTO_CLUSTER_UUID);
        data = xrow_encode_uuid(data, replicaset_uuid);


> 
> static inline int64_t
> @@ -281,7 +281,7 @@ vclock_compare_generic(const struct vclock *a, const struct vclock *b,
> 		       bool ignore_zero)
> {
> 	bool le = true, ge = true;
> -	unsigned int map = a->map | b->map;
> +	uint32_t map = a->map | b->map;
> 	struct bit_iterator it;
> 	bit_iterator_init(&it, &map, sizeof(map), true);
> 

That’s a shame I missed it. Fixed. The changes are on the branch

--
Serge Petrenko
sergepetrenko at tarantool.org




More information about the Tarantool-patches mailing list