From 686c72ba793f023d39c55d296d0a6d97c8f72738 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Tue, 26 Nov 2013 13:17:23 +0400 Subject: [PATCH] Add a workaround for #49: salloc_index_to_ptr is broken --- src/box/bitset_index.cc | 16 ++++++++++++---- test/big/tarantool.cfg | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/box/bitset_index.cc b/src/box/bitset_index.cc index 5e09e341d0..c22b209661 100644 --- a/src/box/bitset_index.cc +++ b/src/box/bitset_index.cc @@ -38,20 +38,28 @@ #include "pickle.h" #include <lib/bitset/index.h> +static inline struct tuple * +value_to_tuple(size_t value); + static inline size_t tuple_to_value(struct tuple *tuple) { - size_t value = salloc_ptr_to_index(tuple); - assert(salloc_ptr_from_index(value) == tuple); + /* + * A workaround for #49: salloc_index_to_ptr is broken + * https://github.com/tarantool/tarantool/issues/49 + */ + /* size_t value = salloc_ptr_to_index(tuple); */ + size_t value = (intptr_t) tuple >> 2; + assert(value_to_tuple(value) == tuple); return value; } static inline struct tuple * value_to_tuple(size_t value) { - return (struct tuple *) salloc_ptr_from_index(value); + /* return (struct tuple *) salloc_ptr_from_index(value); */ + return (struct tuple *) (value << 2); } - struct bitset_index_iterator { struct iterator base; /* Must be the first member. */ struct bitset_iterator bitset_it; diff --git a/test/big/tarantool.cfg b/test/big/tarantool.cfg index 58def14511..821cde5e87 100644 --- a/test/big/tarantool.cfg +++ b/test/big/tarantool.cfg @@ -351,7 +351,7 @@ space[24].enabled = true space[24].index[0].type = "HASH" space[24].index[0].unique = true space[24].index[0].key_field[0].fieldno = 0 -space[24].index[0].key_field[0].type = "NUM" +space[24].index[0].key_field[0].type = "STR" space[24].index[1].type = "BITSET" space[24].index[1].unique = false -- GitLab