We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a1a4d9 commit 8dd6805Copy full SHA for 8dd6805
logic/c.go
@@ -375,6 +375,15 @@ func (p *C) grow() {
375
p.strash = strash
376
}
377
378
+// this is sortof fnv-1a, but we do not do it byte wise
379
+// instead lit-wise (which is 4x wider) and there is no offset.
380
+// It gives the fewest collisions of the hashes we tried.
381
+//
382
+// A close 2nd was b * ^(a<<13), as a is smaller than b
383
+// we have fewer/cheaper operations and only marginally
384
+// more collisions. It was actually faster than the above,
385
+// the increase of collisions was compensated for by
386
+// faster computation (less multiplies).
387
func strashCode(a, b z.Lit) uint32 {
- return uint32(^(a << 13) * b)
388
+ return 16777619 * ^uint32(b) * 16777619 * ^uint32(a)
389
0 commit comments