blueloveTH 3 лет назад
Родитель
Сommit
f3ccd1c7d1
5 измененных файлов с 8 добавлено и 6 удалено
  1. 3 0
      src/__stl__.h
  2. 1 1
      src/hash_table8.hpp
  3. 2 2
      src/main.cpp
  4. 0 2
      src/safestl.h
  5. 2 1
      src/str.h

+ 3 - 0
src/__stl__.h

@@ -23,6 +23,9 @@
 #include <atomic>
 #include <iostream>
 
+#define EMH_WYHASH_HASH 1
+#include "hash_table8.hpp"
+
 #ifdef POCKETPY_H
 #define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()! This should be a bug, please report it");
 #else

+ 1 - 1
src/hash_table8.hpp

@@ -1660,7 +1660,7 @@ one-way search strategy.
 
 #if EMH_WYHASH_HASH
     //#define WYHASH_CONDOM 1
-    inline uint64_t wymix(uint64_t A, uint64_t B)
+    inline static uint64_t wymix(uint64_t A, uint64_t B)
     {
 #if defined(__SIZEOF_INT128__)
         __uint128_t r = A; r *= B;

+ 2 - 2
src/main.cpp

@@ -3,8 +3,8 @@
 
 #include "pocketpy.h"
 
-//#define PK_DEBUG_TIME
-#define PK_DEBUG_THREADED
+#define PK_DEBUG_TIME
+//#define PK_DEBUG_THREADED
 
 struct Timer{
     const char* title;

+ 0 - 2
src/safestl.h

@@ -36,8 +36,6 @@ public:
 };
 
 
-#include "hash_table8.hpp"
-
 class PyVarDict: public emhash8::HashMap<_Str, PyVar> {
     using emhash8::HashMap<_Str, PyVar>::HashMap;
 };

+ 2 - 1
src/str.h

@@ -46,7 +46,8 @@ public:
 
     size_t hash() const{
         if(!hash_initialized){
-            _hash = std::hash<std::string>()(*this);
+            //_hash = std::hash<std::string>()(*this);
+            _hash = emhash8::HashMap<int,int>::wyhashstr(data(), size());
             hash_initialized = true;
         }
         return _hash;