| Index: third_party/sqlite/src/src/hash.c
|
| diff --git a/third_party/sqlite/src/src/hash.c b/third_party/sqlite/src/src/hash.c
|
| index b5886e064152b8face140874a447ec596c11832d..62b695a1bb3447b98f7bffb719ecb0a782e13885 100644
|
| --- a/third_party/sqlite/src/src/hash.c
|
| +++ b/third_party/sqlite/src/src/hash.c
|
| @@ -55,8 +55,12 @@ void sqlite3HashClear(Hash *pH){
|
| static unsigned int strHash(const char *z){
|
| unsigned int h = 0;
|
| unsigned char c;
|
| - while( (c = (unsigned char)*z++)!=0 ){
|
| - h = (h<<3) ^ h ^ sqlite3UpperToLower[c];
|
| + while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
|
| + /* Knuth multiplicative hashing. (Sorting & Searching, p. 510).
|
| + ** 0x9e3779b1 is 2654435761 which is the closest prime number to
|
| + ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
|
| + h += sqlite3UpperToLower[c];
|
| + h *= 0x9e3779b1;
|
| }
|
| return h;
|
| }
|
| @@ -148,7 +152,7 @@ static HashElem *findElementWithHash(
|
| int count; /* Number of elements left to test */
|
| unsigned int h; /* The computed hash */
|
|
|
| - if( pH->ht ){
|
| + if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
|
| struct _ht *pEntry;
|
| h = strHash(pKey) % pH->htsize;
|
| pEntry = &pH->ht[h];
|
|
|