[llvm-commits] CVS: llvm/include/llvm/ADT/StringMap.h

Chris Lattner sabre at nondot.org
Sun Feb 11 14:18:18 PST 2007


On Sun, 11 Feb 2007, Reid Spencer wrote:
>> +    // If the hash table is now more than 3/4 full, or if fewer than 1/8 of
>> +    // the buckets are empty (meaning that many are filled with tombstones),
>> +    // grow the table.
>
> If I get this right, it could also shrink the table, right?

nope, just grow.

>> +    if (NumItems*4 > NumBuckets*3 ||
>> +        NumBuckets-(NumItems+NumTombstones) < NumBuckets/8)
>
> Since you've used this predicate twice and re-written it twice, why not
> make an inline  predicate function for it, so its clear what's going on?
> Something like "isTimeToReHash()" ?

Will do.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-commits mailing list