File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -226,23 +226,16 @@ unsigned StringMapImpl::RehashTable(unsigned BucketNo) {
226
226
for (unsigned I = 0 , E = NumBuckets; I != E; ++I) {
227
227
StringMapEntryBase *Bucket = TheTable[I];
228
228
if (Bucket && Bucket != getTombstoneVal ()) {
229
- // Fast case, bucket available.
229
+ // If the bucket is not available, probe for a spot .
230
230
unsigned FullHash = HashTable[I];
231
231
unsigned NewBucket = FullHash & (NewSize - 1 );
232
- if (!NewTableArray[NewBucket]) {
233
- NewTableArray[FullHash & (NewSize - 1 )] = Bucket;
234
- NewHashArray[FullHash & (NewSize - 1 )] = FullHash;
235
- if (I == BucketNo)
236
- NewBucketNo = NewBucket;
237
- continue ;
232
+ if (NewTableArray[NewBucket]) {
233
+ unsigned ProbeSize = 1 ;
234
+ do {
235
+ NewBucket = (NewBucket + ProbeSize++) & (NewSize - 1 );
236
+ } while (NewTableArray[NewBucket]);
238
237
}
239
238
240
- // Otherwise probe for a spot.
241
- unsigned ProbeSize = 1 ;
242
- do {
243
- NewBucket = (NewBucket + ProbeSize++) & (NewSize - 1 );
244
- } while (NewTableArray[NewBucket]);
245
-
246
239
// Finally found a slot. Fill it in.
247
240
NewTableArray[NewBucket] = Bucket;
248
241
NewHashArray[NewBucket] = FullHash;
You can’t perform that action at this time.
0 commit comments