From 1b499974a0dac1d1e9505608bcbca40d4b96d85a Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sun, 29 Nov 2020 11:02:01 -0700 Subject: [PATCH] sideline unused HashMap.hh --- {include/sta => util}/HashMap.hh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) rename {include/sta => util}/HashMap.hh (98%) diff --git a/include/sta/HashMap.hh b/util/HashMap.hh similarity index 98% rename from include/sta/HashMap.hh rename to util/HashMap.hh index 10766415..cef153db 100644 --- a/include/sta/HashMap.hh +++ b/util/HashMap.hh @@ -14,8 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef STA_HASHMAP_H -#define STA_HASHMAP_H +#pragma once #include // size_t #include "Hash.hh" @@ -29,7 +28,7 @@ template class PtrHash { public: - Hash operator()(const OBJECT obj) const { return hashPtr(obj); } + size_t operator()(const OBJECT obj) const { return hashPtr(obj); } }; template @@ -77,8 +76,8 @@ public: void deleteContentsClear(); void deleteArrayContentsClear(); int longestBucketLength() const; - Hash longestBucketHash() const; - int bucketLength(Hash hash) const; + size_t longestBucketHash() const; + int bucketLength(size_t hash) const; void deleteContents() @@ -539,11 +538,11 @@ HashMap::longestBucketLength() const } template -Hash +size_t HashMap::longestBucketHash() const { int longest = 0; - Hash longest_hash = 0; + size_t longest_hash = 0; for (size_t hash = 0; hash < capacity_; hash++) { int length = bucketLength(hash); if (length > longest) { @@ -556,7 +555,7 @@ HashMap::longestBucketHash() const template int -HashMap::bucketLength(Hash hash) const +HashMap::bucketLength(size_t hash) const { int length = 0; for (HashMapBucket *bucket = table_[hash]; @@ -567,4 +566,3 @@ HashMap::bucketLength(Hash hash) const } } // namespace -#endif