[tarantool-patches] Re: [PATCH 1/1] salad: fix mhash 'random' method

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Mar 1 12:40:43 MSK 2019



On 01/03/2019 01:04, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/03/01 00:29]:
>> -	return h->n_buckets;
>> +	mh_int_t res = mh_next(h, rnd % mh_end(h));
>> +	if (res != mh_end(h))
>> +		return res;
>> +	return mh_first(h);
> 
> 
> Well, it takes some time to understand this code.

IMO, it is much better to encapsulate those 'for' loops
scanning for an occupied non-dirty slot, than put them
into each function, working with buckets array.

> 
> OK to push.

Pushed to 2.1.

> 
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov
> 



More information about the Tarantool-patches mailing list