This commit is contained in:
blueloveTH 2023-04-18 01:26:47 +08:00
parent ecccf7a7ec
commit 251e72bca9

View File

@ -6,7 +6,7 @@
namespace pkpy{
const std::vector<uint16_t> kHashSeeds = {9629, 43049, 13267, 59509, 39251, 1249, 35803, 54469, 27689, 9719, 34897, 18973, 30661, 19913, 27919, 32143, 3467, 28019, 1051, 39419, 1361, 28547, 48197, 2609, 24317, 22861, 41467, 17623, 52837, 59053, 33589, 32117};
const std::vector<uint16_t> kHashSeeds = {9629, 43049, 13267, 59509, 39251, 1249, 35803, 54469, 27689, 9719, 34897, 18973, 30661, 19913, 27919, 32143};
inline uint16_t find_next_power_of_2(uint16_t n){
uint16_t x = 2;
@ -18,7 +18,8 @@ inline uint16_t find_next_power_of_2(uint16_t n){
inline uint16_t find_perfect_hash_seed(uint16_t capacity, const std::vector<StrName>& keys){
if(keys.empty()) return kHashSeeds[0];
std::set<uint16_t> indices;
static std::set<uint16_t> indices;
indices.clear();
std::pair<uint16_t, float> best_score = {kHashSeeds[0], 0.0f};
for(int i=0; i<kHashSeeds.size(); i++){
indices.clear();