blueloveTH 2 年之前
父節點
當前提交
251e72bca9
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/namedict.h

+ 3 - 2
src/namedict.h

@@ -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();