Searched refs:lookup3 (Results 1 - 2 of 2) sorted by relevance

/lucene-3.6.0/solr/solrj/src/test/org/apache/solr/common/util/
H A DTestHash.java32 /*** the hash values were generated by adding the following to lookup3.c
50 int hash = Hash.lookup3(a, 0, len, i*12345);
65 int hash = Hash.lookup3(utf32, 0, len, seed -(len<<2));
/lucene-3.6.0/solr/solrj/src/java/org/apache/solr/common/util/
H A DHash.java27 * <p>So I set out to create a standard 32 bit string hash that would be well defined for implementation in all languages, have very high performance, and have very good hash properties such as distribution. After evaluating all the options, I settled on using Bob Jenkins' lookup3 as a base. It's a well studied and very fast hash function, and the hashword variant can work with 32 bits at a time (perfect for hashing unicode code points). It's also even faster on the latest JVMs which can translate pairs of shifts into native rotate instructions.
29 * <p>The only problem with using lookup3 hashword is that it includes a length in the initial value. This would suck some performance out since directly hashing a UTF8 or UTF16 string (Java) would require a pre-scan to get the actual number of unicode code points. The solution was to simply remove the length factor, which is equivalent to biasing initVal by -(numCodePoints*4). This slightly modified lookup3 I define as lookup3ycs.
33 * <p>The hash value of a character sequence (a string) is defined to be the hash of its unicode code points, according to lookup3 hashword, with the initval biased by -(length*4).
38 * lookup3ycs(k,offset,length,initval) == lookup3(k,offset,length,initval-(length*4))
42 * lookup3ycs(k,offset,length,initval+(length*4)) == lookup3(k,offset,length,initval)
44 * <p>An obvious advantage of this relationship is that you can use lookup3 if you don't have an implementation of lookup3ycs.
52 * A Java implementation of hashword from lookup3.c by Bob Jenkins
53 * (<a href="http://burtleburtle.net/bob/c/lookup3.c">original source</a>).
62 public static int lookup3(in method in class:Hash
[all...]

Completed in 247 milliseconds