diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H index 74533d04161ebc4862f6559fb4a42a2387882f1a..fbff84f808f00f067b5151f5b7b53fe602ca419f 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H @@ -57,7 +57,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class multiphaseMixture Declaration + Class multiphaseMixture Declaration \*---------------------------------------------------------------------------*/ class multiphaseMixture @@ -85,15 +85,6 @@ public: { return word::hash()(key.first()) + word::hash()(key.second()); } - - label operator() - ( - const interfacePair& key, - const label tableSize - ) const - { - return mag(operator()(key)) % tableSize; - } }; diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C index e1def941d6167d381dd9c164d0dc5040cb8a45ea..c2034a69eabd17e789c050714b1085d75004cff9 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C @@ -30,20 +30,49 @@ License #include "HashTable.H" #include "List.H" +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class T, class Key, class Hash> +Foam::label Foam::HashTable<T, Key, Hash>::canonicalSize(const label size) +{ + if (size < 1) + { + return 0; + } + + // enforce power of two + unsigned int goodSize = size; + + if (goodSize & (goodSize - 1)) + { + // brute-force is fast enough + goodSize = 1; + while (goodSize < unsigned(size)) + { + goodSize <<= 1; + } + } + + return goodSize; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class T, class Key, class Hash> Foam::HashTable<T, Key, Hash>::HashTable(const label size) : - tableSize_(size), - table_(NULL), + HashTableName(), nElmts_(0), + tableSize_(canonicalSize(size)), + table_(NULL), endIter_(*this, NULL, 0), endConstIter_(*this, NULL, 0) { if (tableSize_) { table_ = new hashedEntry*[tableSize_]; + for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++) { table_[hashIdx] = 0; @@ -56,9 +85,9 @@ template<class T, class Key, class Hash> Foam::HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht) : HashTableName(), + nElmts_(0), tableSize_(ht.tableSize_), table_(NULL), - nElmts_(0), endIter_(*this, NULL, 0), endConstIter_(*this, NULL, 0) { @@ -85,9 +114,9 @@ Foam::HashTable<T, Key, Hash>::HashTable ) : HashTableName(), + nElmts_(0), tableSize_(0), table_(NULL), - nElmts_(0), endIter_(*this, NULL, 0), endConstIter_(*this, NULL, 0) { @@ -115,7 +144,7 @@ bool Foam::HashTable<T, Key, Hash>::found(const Key& key) const { if (nElmts_) { - const label hashIdx = Hash()(key, tableSize_); + const label hashIdx = hashKeyIndex(key); for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) { @@ -147,7 +176,7 @@ Foam::HashTable<T, Key, Hash>::find { if (nElmts_) { - const label hashIdx = Hash()(key, tableSize_); + const label hashIdx = hashKeyIndex(key); for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) { @@ -179,7 +208,7 @@ Foam::HashTable<T, Key, Hash>::find { if (nElmts_) { - label hashIdx = Hash()(key, tableSize_); + const label hashIdx = hashKeyIndex(key); for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_) { @@ -231,7 +260,8 @@ bool Foam::HashTable<T, Key, Hash>::set resize(2); } - label hashIdx = Hash()(key, tableSize_); + const label hashIdx = hashKeyIndex(key); + hashedEntry* existing = 0; hashedEntry* prev = 0; @@ -449,14 +479,16 @@ Foam::label Foam::HashTable<T, Key, Hash>::erase template<class T, class Key, class Hash> -void Foam::HashTable<T, Key, Hash>::resize(const label newSize) +void Foam::HashTable<T, Key, Hash>::resize(const label sz) { + label newSize = canonicalSize(sz); + if (newSize == tableSize_) { # ifdef FULLDEBUG if (debug) { - Info<< "HashTable<T, Key, Hash>::resize(const label newSize) : " + Info<< "HashTable<T, Key, Hash>::resize(const label) : " << "new table size == old table size\n"; } # endif diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 65a5635e167f7bd813e74a3a026f0d8d36799b3a..64812044dafd0ec1f7e221c1ee81ffb95481b596 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -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); diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H index f117a601b92ffb8b772d856a8c42034007fd3aee..e50d307968ced25b5d34df39a33f688f746fd2a5 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H @@ -42,6 +42,17 @@ inline Foam::HashTable<T, Key, Hash>::hashedEntry::hashedEntry {} +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class T, class Key, class Hash> +inline Foam::label +Foam::HashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const +{ + // size is power of two - this is the modulus + return Hash()(key) & (tableSize_ - 1); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, class Key, class Hash> diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C index 1525d1d72edbb1aac20a69fc65208a5702bf14d7..2a407b44a5a65e1f9e7d4432f400f91b9755f631 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C @@ -33,15 +33,16 @@ License template<class T, class Key, class Hash> Foam::HashTable<T, Key, Hash>::HashTable(Istream& is, const label size) : - tableSize_(size), - table_(new hashedEntry*[tableSize_]), + HashTableName(), nElmts_(0), + tableSize_(canonicalSize(size)), + table_(new hashedEntry*[tableSize_]), endIter_(*this, NULL, 0), endConstIter_(*this, NULL, 0) { - for (label i=0; i < tableSize_; i++) + for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++) { - table_[i] = 0; + table_[hashIdx] = 0; } operator>>(is, *this); diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C index 7b011e135e5a1af2d31b7ecbdd221f6a6a2c52c0..9b08bb3e670cfe8f618bc17951ecfee72f5d81a1 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C @@ -31,6 +31,33 @@ License #include "List.H" #include "IOstreams.H" +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class T, class Key, class Hash> +Foam::label Foam::StaticHashTable<T, Key, Hash>::canonicalSize(const label size) +{ + if (size < 1) + { + return 0; + } + + // enforce power of two + unsigned int goodSize = size; + + if (goodSize & (goodSize - 1)) + { + // brute-force is fast enough + goodSize = 1; + while (goodSize < unsigned(size)) + { + goodSize <<= 1; + } + } + + return goodSize; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct given initial table size @@ -38,8 +65,8 @@ template<class T, class Key, class Hash> Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size) : StaticHashTableName(), - keys_(size), - objects_(size), + keys_(canonicalSize(size)), + objects_(keys_.size()), nElmts_(0), endIter_(*this, keys_.size(), 0), endConstIter_(*this, keys_.size(), 0) @@ -75,7 +102,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable template<class T, class Key, class Hash> Foam::StaticHashTable<T, Key, Hash>::StaticHashTable ( - const Xfer<StaticHashTable<T, Key, Hash> >& ht + const Xfer< StaticHashTable<T, Key, Hash> >& ht ) : StaticHashTableName(), @@ -103,7 +130,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::found(const Key& key) const { if (nElmts_) { - label hashIdx = Hash()(key, keys_.size()); + const label hashIdx = hashKeyIndex(key); const List<Key>& localKeys = keys_[hashIdx]; forAll(localKeys, elemIdx) @@ -136,7 +163,7 @@ Foam::StaticHashTable<T, Key, Hash>::find { if (nElmts_) { - label hashIdx = Hash()(key, keys_.size()); + const label hashIdx = hashKeyIndex(key); const List<Key>& localKeys = keys_[hashIdx]; forAll(localKeys, elemIdx) @@ -167,14 +194,17 @@ Foam::StaticHashTable<T, Key, Hash>::find const Key& key ) const { - label hashIdx = Hash()(key, keys_.size()); - const List<Key>& localKeys = keys_[hashIdx]; - - forAll(localKeys, elemIdx) + if (nElmts_) { - if (key == localKeys[elemIdx]) + const label hashIdx = hashKeyIndex(key); + const List<Key>& localKeys = keys_[hashIdx]; + + forAll(localKeys, elemIdx) { - return const_iterator(*this, hashIdx, elemIdx); + if (key == localKeys[elemIdx]) + { + return const_iterator(*this, hashIdx, elemIdx); + } } } @@ -186,7 +216,7 @@ Foam::StaticHashTable<T, Key, Hash>::find } # endif - return end(); + return cend(); } @@ -197,7 +227,7 @@ Foam::List<Key> Foam::StaticHashTable<T, Key, Hash>::toc() const List<Key> tofc(nElmts_); label i = 0; - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { tofc[i++] = iter.key(); } @@ -214,7 +244,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::set const bool protect ) { - label hashIdx = Hash()(key, keys_.size()); + const label hashIdx = hashKeyIndex(key); List<Key>& localKeys = keys_[hashIdx]; label existing = localKeys.size(); @@ -375,8 +405,10 @@ Foam::label Foam::StaticHashTable<T, Key, Hash>::erase template<class T, class Key, class Hash> -void Foam::StaticHashTable<T, Key, Hash>::resize(const label newSize) +void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz) { + label newSize = canonicalSize(sz); + if (newSize == keys_.size()) { # ifdef FULLDEBUG @@ -394,7 +426,7 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label newSize) { FatalErrorIn ( - "StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)" + "StaticHashTable<T, Key, Hash>::resize(const label)" ) << "Illegal size " << newSize << " for StaticHashTable." << " Minimum size is 1" << abort(FatalError); } @@ -402,7 +434,7 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label newSize) StaticHashTable<T, Key, Hash> newTable(newSize); - for (iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { newTable.insert(iter.key(), *iter); } @@ -499,7 +531,7 @@ void Foam::StaticHashTable<T, Key, Hash>::operator= } - for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter) + for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter) { insert(iter.key(), *iter); } @@ -512,22 +544,22 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator== ) const { // Are all my elements in rhs? - for (const_iterator iter = begin(); iter != end(); ++iter) + for (const_iterator iter = cbegin(); iter != cend(); ++iter) { const_iterator fnd = rhs.find(iter.key()); - if (fnd == rhs.end() || fnd() != iter()) + if (fnd == rhs.cend() || fnd() != iter()) { return false; } } // Are all rhs elements in me? - for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter) + for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter) { const_iterator fnd = find(iter.key()); - if (fnd == end() || fnd() != iter()) + if (fnd == cend() || fnd() != iter()) { return false; } diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H index 60ed0e6fbb29a524e4c59ee558ac312c94fd1810..e0a01746f9d421fb24dc38340aa78d06f0a00b81 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H @@ -99,6 +99,13 @@ class StaticHashTable //- The current number of elements in table label nElmts_; + //- 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 hashed entry to a possibly already existing key bool set(const Key&, const T& newElmt, bool protect); @@ -150,7 +157,7 @@ public: StaticHashTable(const StaticHashTable<T, Key, Hash>&); //- Construct by transferring the parameter contents - StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&); + StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&); // Destructor @@ -218,7 +225,7 @@ public: void transfer(StaticHashTable<T, Key, Hash>&); //- Transfer contents to the Xfer container - inline Xfer<StaticHashTable<T, Key, Hash> > xfer(); + inline Xfer< StaticHashTable<T, Key, Hash> > xfer(); // Member Operators diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H index 6ea55beae726dfe7e026b73cee305c81e6a74d99..88f2d9bdb949307800b0260a2dc4f9db8b89eeb9 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H @@ -29,6 +29,17 @@ License // * * * * * * * * * * * * * Private Member Classes * * * * * * * * * * * * // +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class T, class Key, class Hash> +inline Foam::label +Foam::StaticHashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const +{ + // size is power of two - this is the modulus + return Hash()(key) & (keys_.size() - 1); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, class Key, class Hash> @@ -68,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set template<class T, class Key, class Hash> -inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> > +inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> > Foam::StaticHashTable<T, Key, Hash>::xfer() { return xferMove(*this); diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index 0079f13a0290e09eeac0ec998d64242ff9c770a6..2cb2cfcea38f2cc41ec4e74a5f1c40b2a31284fd 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -80,17 +80,12 @@ public: // Rotating hash from http://burtleburtle.net/bob/hash/doobs.html template<class HashT=Hash<T> > class Hash - : - public Foam::Hash<FixedList<T, Size> > { public: - inline Hash(); + Hash() + {} + label operator()(const FixedList<T, Size>&) const; - label operator() - ( - const FixedList<T, Size>&, - const label tableSize - ) const; }; // Static Member Functions diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index 4820ecc7f9375b5e37e05efcd620d0939ffa9a87..66a6257be82166fc36aba0158004e5def066d269 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H @@ -403,11 +403,6 @@ inline bool Foam::FixedList<T, Size>::empty() const #ifndef __CINT__ -template<class T, Foam::label Size> -template<class HashT> -inline Foam::FixedList<T, Size>::Hash<HashT>::Hash() -{} - // Rotating Hash template<class T, Foam::label Size> @@ -429,17 +424,6 @@ inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator() return val; } -template<class T, Foam::label Size> -template<class HashT> -inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator() -( - const FixedList<T, Size>& lst, - const label tableSize -) const -{ - return ::abs(operator()(lst)) % tableSize; -} -#endif - +#endif // __CINT__ // ************************************************************************* // diff --git a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H index 610f54282a9b7e483b6dd6f0252e1b5bd049531e..086a2c765532fa3f0ef531318c5d373670afdfce 100644 --- a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H @@ -38,7 +38,7 @@ SourceFiles #include "HashTable.H" #include "label.H" -#include "pTraits.H" +#include "Hash.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,31 +46,9 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class dlLibraryTable Declaration + Class dlLibraryTable Declaration \*---------------------------------------------------------------------------*/ -//- A means of hashing pointer addresses -template<> -class Hash<void*> -{ - -public: - - Hash() - {} - - long operator()(const void* const& p) const - { - return long(p); - } - - label operator()(const void* const& p, const label tableSize) const - { - return abs(operator()(p)) % tableSize; - } -}; - - class dlLibraryTable : public HashTable<fileName, void*, Hash<void*> > diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H index b0bb1f4e645b678716edbe03614bbed266038620..c726ad941c20c4e0bb53b871f572e58071a657fb 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H @@ -133,12 +133,12 @@ public: }; -//- Hash<edge> specialisation +//- Hash specialization for hashing edges // Simple commutative hash. template<> inline label Hash<edge>::operator()(const edge& e) const { - return e[0]*e[1] + e[0]+e[1]; + return (e[0]*e[1] + e[0]+e[1]); } template<> diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H index 90512b712b482396fbb4e26aacce39be27b42d80..c962a4fc5d406e876d1eca6a89d8e6515b68f91b 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H @@ -164,7 +164,7 @@ public: }; -//- Hash<triFace> specialisation +//- Hash specialization for hashing triFace // Simple commutative hash. template<> inline label Hash<triFace>::operator()(const triFace& t) const diff --git a/src/OpenFOAM/primitives/hashes/Hash/Hash.H b/src/OpenFOAM/primitives/hashes/Hash/Hash.H index ab8aa07a3b84ea9b0381affdf1ac9ab9b9ea97b8..7675d44bbbd48b25dbbf88cd67952a3f076f4812 100644 --- a/src/OpenFOAM/primitives/hashes/Hash/Hash.H +++ b/src/OpenFOAM/primitives/hashes/Hash/Hash.H @@ -27,7 +27,7 @@ Class Description Hash function class for primitives. All non-primitives used to hash - entries on hash tables need a specialised version of this class. + entries on hash tables need a specialized version of this class. \*---------------------------------------------------------------------------*/ @@ -35,6 +35,7 @@ Description #define Hash_H #include "label.H" +#include "pTraits.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class Hash Declaration + Class Hash Declaration \*---------------------------------------------------------------------------*/ template<class PrimitiveType> @@ -59,10 +60,26 @@ public: return label(p); } - label operator()(const PrimitiveType& p, const label tableSize) const +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Hash specialization for hashing pointer addresses +template<> +class Hash<void*> +{ + +public: + + Hash() + {} + + long operator()(const void* const& p) const { - return mag(operator()(p)) % tableSize; + return long(p); } + }; diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H index 714c72a3358f8be06b3d9a2cf65e32a7e23378aa..86bbb2a1f5fe69a3b7e377806322f5c4b8a2a75c 100644 --- a/src/OpenFOAM/primitives/strings/string/string.H +++ b/src/OpenFOAM/primitives/strings/string/string.H @@ -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; }; diff --git a/src/OpenFOAM/primitives/strings/string/stringI.H b/src/OpenFOAM/primitives/strings/string/stringI.H index 0720c27257089aeffefd6b3242b66423e14051c5..dc8c0e8fa06b013afb3bca16500d40fede7ecd41 100644 --- a/src/OpenFOAM/primitives/strings/string/stringI.H +++ b/src/OpenFOAM/primitives/strings/string/stringI.H @@ -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; -} - - // ************************************************************************* //