Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 21x 21x 251972x 251972x 251972x 21x | /**
* Fast, non-cryptographic 32-bit hash for string content comparison.
* Used only for dirty-flag optimisation — not collision-resistant.
*/
export function simpleHash(str: string): number {
let hash = 0;
for (const char of str) {
hash = Math.trunc(Math.imul(31, hash) + (char.codePointAt(0) ?? 0));
Iif (hash > 2147483647) {
hash -= 4294967296;
} else if (Ihash < -2147483648) {
hash += 4294967296;
}
}
return hash;
}
|