4 ms·
This set of symbols has some interesting properties which allow for this solution: func symbolHash(c byte) byte { x := (c - 1) >> 5 y := in
by duskwuff 1y ago
This set of symbols has some interesting properties which allow for this solution:
func symbolHash(c byte) byte {
x := (c - 1) >> 5
y := int(c) + 0x1b150000>>(x<<3)
return byte(y & 31)
}
But this doesn't generalize - it depends on the input consisting of a couple runs of consecutive characters which can be made continuous. (Extra credit: why is "c-1" necessary?)