소스 검색

yet another multiplier for string hashing, 136671 produces no collisions for wamerican-huge and 31 for wamerican-insane

Kajetan Johannes Hammerle 4 년 전
부모
커밋
1be54ee943
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      utils/StringBuffer.h

+ 1 - 1
utils/StringBuffer.h

@@ -11,7 +11,7 @@ class StringBuffer final {
     char data[N];
 
     void addToHash(char c) {
-        hash = 257 * hash + c;
+        hash = 136671 * hash + c;
     }
 
     void addToHash(int from, int to) {