Re: [CFReview] Red-Black Tree
Teodor Sigaev <teodor@sigaev.ru>
From: Teodor Sigaev <teodor@sigaev.ru>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2010-02-10T18:40:16Z
Lists: pgsql-hackers
Attachments
- rbtree-0.13.gz (application/x-tar)
> So suppose at this point that step is the largest integer that can be
> represented...
>> ! step ++;
> Boom.
>> ! step>>= 1;
step>>= 1;
step ++'
Unboom?
>> !
>> ! while(step> 0) {
>> ! int i;
>>
>> ! for (i = step-1; i< nentry; i += 2 * step)
>
> And similarly here... if nentry is greater than maxint/2, then i += 2
> * step will overflow, no?
Agree, so
for (i = step - 1; i < nentry && i >= 0; i += step << 1 /* *2 */)
Also, rb_free is removed per Tom's comment. Can I commit the patch?
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/