mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 04:20:17 +00:00
replace hash fn
This commit is contained in:
parent
fcdff94be3
commit
f3ccd1c7d1
@ -23,6 +23,9 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#define EMH_WYHASH_HASH 1
|
||||||
|
#include "hash_table8.hpp"
|
||||||
|
|
||||||
#ifdef POCKETPY_H
|
#ifdef POCKETPY_H
|
||||||
#define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()! This should be a bug, please report it");
|
#define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()! This should be a bug, please report it");
|
||||||
#else
|
#else
|
||||||
|
@ -1660,7 +1660,7 @@ one-way search strategy.
|
|||||||
|
|
||||||
#if EMH_WYHASH_HASH
|
#if EMH_WYHASH_HASH
|
||||||
//#define WYHASH_CONDOM 1
|
//#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__)
|
#if defined(__SIZEOF_INT128__)
|
||||||
__uint128_t r = A; r *= B;
|
__uint128_t r = A; r *= B;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "pocketpy.h"
|
#include "pocketpy.h"
|
||||||
|
|
||||||
//#define PK_DEBUG_TIME
|
#define PK_DEBUG_TIME
|
||||||
#define PK_DEBUG_THREADED
|
//#define PK_DEBUG_THREADED
|
||||||
|
|
||||||
struct Timer{
|
struct Timer{
|
||||||
const char* title;
|
const char* title;
|
||||||
|
@ -36,8 +36,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include "hash_table8.hpp"
|
|
||||||
|
|
||||||
class PyVarDict: public emhash8::HashMap<_Str, PyVar> {
|
class PyVarDict: public emhash8::HashMap<_Str, PyVar> {
|
||||||
using emhash8::HashMap<_Str, PyVar>::HashMap;
|
using emhash8::HashMap<_Str, PyVar>::HashMap;
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,8 @@ public:
|
|||||||
|
|
||||||
size_t hash() const{
|
size_t hash() const{
|
||||||
if(!hash_initialized){
|
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;
|
hash_initialized = true;
|
||||||
}
|
}
|
||||||
return _hash;
|
return _hash;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user