ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/PApp-SQL/SQL.xs
(Generate patch)

Comparing PApp-SQL/SQL.xs (file contents):
Revision 1.30 by root, Mon Jun 24 19:24:01 2019 UTC vs.
Revision 1.31 by root, Thu Sep 9 13:57:41 2021 UTC

175/* this is primitive, yet effective */ 175/* this is primitive, yet effective */
176/* the returned value must never be zero (or bad things will happen) */ 176/* the returned value must never be zero (or bad things will happen) */
177static U32 177static U32
178lru_hash (SV *dbh, SV *sql) 178lru_hash (SV *dbh, SV *sql)
179{ 179{
180 /* use a variant of fnv1a */
180 STRLEN i, l; 181 STRLEN i, l;
181 char *b = SvPV (sql, l); 182 char *b = SvPV (sql, l);
182 U32 hash = 2166136261U; 183 U32 hash = 2166136261U;
183 184
184 hash = (hash ^ (U32)dbh) * 16777619U; 185 hash = (hash ^ (U32)dbh) * 16777619U;
185 hash = (hash ^ l) * 16777619U; 186 hash = (hash ^ l) * 16777619U;
186 187
187 /* start hashing at char 8, as this skips the "select " prefix */ 188 /* start hashing at char 7, as this skips the "select " prefix */
189 /* also skip more and more octets */
188 for (i = 7; i < l; i += i >> 2) 190 for (i = 7; i < l; i += i >> 2)
189 hash = (hash ^ b [i]) * 16777619U; 191 hash = (hash ^ b [i]) * 16777619U;
190 192
191 return hash; 193 return hash;
192} 194}
193 195
194/* fetch and "use" */ 196/* fetch and "use" */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines