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:
Mark Olesen
2009-02-26 17:49:47 +01:00
parent 2aeee852e8
commit a46c85f5a4
16 changed files with 177 additions and 124 deletions

View File

@ -89,9 +89,10 @@ public:
class hash
{
public:
inline hash();
hash()
{}
inline size_type operator()(const string&) const;
inline size_type operator()(const string&, const size_type) const;
};

View File

@ -196,10 +196,6 @@ inline Foam::string Foam::string::operator()(const size_type n) const
}
inline Foam::string::hash::hash()
{}
inline Foam::string::size_type Foam::string::hash::operator()
(
const string& key
@ -216,14 +212,4 @@ inline Foam::string::size_type Foam::string::hash::operator()
}
inline Foam::string::size_type Foam::string::hash::operator()
(
const string& key,
const size_type tableSize
) const
{
return ::abs(operator()(key)) % tableSize;
}
// ************************************************************************* //