|
@@ -4,6 +4,7 @@
|
|
#include "data/LinkedList.h"
|
|
#include "data/LinkedList.h"
|
|
#include "data/List.h"
|
|
#include "data/List.h"
|
|
#include "utils/ArrayString.h"
|
|
#include "utils/ArrayString.h"
|
|
|
|
+#include "utils/HashCode.h"
|
|
|
|
|
|
namespace Core {
|
|
namespace Core {
|
|
template<typename K, typename V>
|
|
template<typename K, typename V>
|
|
@@ -284,27 +285,10 @@ namespace Core {
|
|
private:
|
|
private:
|
|
template<typename H>
|
|
template<typename H>
|
|
int hashIndex(const H& key) const {
|
|
int hashIndex(const H& key) const {
|
|
- return static_cast<int>(fullHash(key)) &
|
|
|
|
|
|
+ return static_cast<int>(hashCode(key)) &
|
|
(nodePointers.getLength() - 1);
|
|
(nodePointers.getLength() - 1);
|
|
}
|
|
}
|
|
|
|
|
|
- template<typename H>
|
|
|
|
- Hash fullHash(const H& key) const {
|
|
|
|
- return key.hashCode();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Hash fullHash(int key) const {
|
|
|
|
- static_assert(sizeof(key) == sizeof(Hash),
|
|
|
|
- "unwanted loose of precision in hash");
|
|
|
|
- return static_cast<Hash>(key);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Hash fullHash(unsigned int key) const {
|
|
|
|
- static_assert(sizeof(key) == sizeof(Hash),
|
|
|
|
- "unwanted loose of precision in hash");
|
|
|
|
- return key;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
const V* searchList(const K& key, int h) const {
|
|
const V* searchList(const K& key, int h) const {
|
|
if(nodePointers.getLength() == 0) {
|
|
if(nodePointers.getLength() == 0) {
|
|
return nullptr;
|
|
return nullptr;
|