mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
HashTable changes
- make table power-of-two, but since it seems to give 1-2% performance improvement, maybe forget it too. - remove two-argument form of hashing classes and do the modulus direclty within HashTable instead. This simplifies things a fair bit. - migrate Hash<void*> from db/dlLibrary to primitives/hashes/Hash
This commit is contained in:
@ -108,18 +108,25 @@ class HashTable
|
||||
|
||||
// Private data: size of table, the table and current number of elements
|
||||
|
||||
//- The current number of elements in table
|
||||
label nElmts_;
|
||||
|
||||
//- Number of primary entries allocated in table (not necessarily used)
|
||||
label tableSize_;
|
||||
|
||||
//- The table of primary entries
|
||||
hashedEntry** table_;
|
||||
|
||||
//- The current number of elements in table
|
||||
label nElmts_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return a canonical (power-of-two) size
|
||||
static label canonicalSize(const label);
|
||||
|
||||
//- Return the hash index of the Key within the current table size.
|
||||
// No checks for zero-sized tables.
|
||||
inline label hashKeyIndex(const Key&) const;
|
||||
|
||||
//- Assign a new hashedEntry to a possibly already existing key
|
||||
bool set(const Key&, const T& newElmt, bool protect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user