@@ -2283,7 +2283,7 @@ function initSearch(rawSearchIndex) {
2283
2283
parsedQuery . elems . sort ( sortQ ) ;
2284
2284
parsedQuery . returned . sort ( sortQ ) ;
2285
2285
for ( i = 0 , nSearchWords = searchWords . length ; i < nSearchWords ; ++ i ) {
2286
- handleArgs ( searchIndex [ i ] , i , results_others ) ;
2286
+ handleArgs ( searchIndex [ i ] , searchIndex [ i ] . id , results_others ) ;
2287
2287
}
2288
2288
}
2289
2289
}
@@ -2847,23 +2847,32 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2847
2847
* @param {Set<number> } fps - Set of distinct items
2848
2848
*/
2849
2849
function buildFunctionTypeFingerprint ( type , output , fps ) {
2850
-
2851
2850
let input = type . id ;
2852
2851
// All forms of `[]` get collapsed down to one thing in the bloom filter.
2853
2852
// Differentiating between arrays and slices, if the user asks for it, is
2854
2853
// still done in the matching algorithm.
2855
2854
if ( input === typeNameIdOfArray || input === typeNameIdOfSlice ) {
2856
2855
input = typeNameIdOfArrayOrSlice ;
2857
2856
}
2858
- if ( input !== null ) {
2857
+ const fxScram = k => {
2859
2858
// https://docs.rs/rustc-hash/1.1.0/src/rustc_hash/lib.rs.html#60
2860
- // Rotate is skipped because we're only doing one cycle anyway.
2861
- const h0 = Math . imul ( input , 0x9e3779b9 ) ;
2862
- const h1 = Math . imul ( 479001599 ^ input , 0x9e3779b9 ) ;
2863
- const h2 = Math . imul ( 433494437 ^ input , 0x9e3779b9 ) ;
2864
- output [ 0 ] |= 1 << ( h0 % 32 ) ;
2865
- output [ 1 ] |= 1 << ( h1 % 32 ) ;
2866
- output [ 2 ] |= 1 << ( h2 % 32 ) ;
2859
+ return Math . imul ( ( k << 5 ) | ( k >> 27 ) , 0x9e3779b9 ) ;
2860
+ } ;
2861
+ const murmurScram = k => {
2862
+ // https://en.wikipedia.org/wiki/MurmurHash
2863
+ k = Math . imul ( k , 0xcc9e2d51 ) ;
2864
+ return Math . imul ( ( k << 15 ) | ( k >> 17 ) , 0x1b873593 ) ;
2865
+ } ;
2866
+ if ( input !== null ) {
2867
+ const h0a = fxScram ( input ) ;
2868
+ const h0b = murmurScram ( input ) ;
2869
+ const h1a = fxScram ( 479001599 ^ input ) ;
2870
+ const h1b = murmurScram ( 479001599 ^ input ) ;
2871
+ const h2a = fxScram ( 433494437 ^ input ) ;
2872
+ const h2b = murmurScram ( 433494437 ^ input ) ;
2873
+ output [ 0 ] |= ( 1 << ( h0a % 32 ) ) | ( 1 << ( h0b % 32 ) ) ;
2874
+ output [ 1 ] |= ( 1 << ( h1a % 32 ) ) | ( 1 << ( h1b % 32 ) ) ;
2875
+ output [ 2 ] |= ( 1 << ( h2a % 32 ) ) | ( 1 << ( h2b % 32 ) ) ;
2867
2876
fps . add ( input ) ;
2868
2877
}
2869
2878
for ( const g of type . generics ) {
@@ -2892,7 +2901,6 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2892
2901
* This function might return 0!
2893
2902
*/
2894
2903
function compareTypeFingerprints ( fullId , queryFingerprint ) {
2895
-
2896
2904
const fh0 = functionTypeFingerprint [ fullId * 4 ] ;
2897
2905
const fh1 = functionTypeFingerprint [ ( fullId * 4 ) + 1 ] ;
2898
2906
const fh2 = functionTypeFingerprint [ ( fullId * 4 ) + 2 ] ;
0 commit comments