MCPcopy Create free account
hub / github.com/buggins/coolreader / reHash

Method reHash

crengine/src/lvstring.cpp:1255–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1253}
1254
1255void lString16HashedCollection::reHash( int newSize )
1256{
1257 if ( hashSize == (lUInt32)newSize )
1258 return;
1259 clearHash();
1260 hashSize = newSize;
1261 if ( hashSize>0 ) {
1262 hash = (HashPair *)malloc( sizeof(HashPair) * hashSize );
1263 for ( unsigned i=0; i<hashSize; i++ )
1264 hash[i].clear();
1265 }
1266 for ( unsigned i=0; i<length(); i++ ) {
1267 lUInt32 h = calcStringHash( at(i).c_str() );
1268 lUInt32 n = h % hashSize;
1269 addHashItem( n, i );
1270 }
1271}
1272
1273size_t lString16HashedCollection::add( const lChar16 * s )
1274{

Callers

nothing calls this directly

Calls 3

calcStringHashFunction · 0.85
clearMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected