How hard is it to check for whitespace?

17 points by serce 11 hours ago on lobsters | 4 comments

0x2ba22e11 | 10 hours ago

Perfect hashing is ready cute! The implementation is very small and simple even though it's very fast: it's just the proof that it does actually work which is complicated. :D

notgull | 8 hours ago

The magic 1682554634 number does look magical, and it's unclear to me how it was chosen (please do share if you know the answer).

I think it’s usually just brute forced, right?

[OP] serce | 58 minutes ago

I think it’s usually just brute forced, right?

Quite possibly, but I'm not sure how and why they arrived at exactly this number since it's one of many options.

jkoppel | 37 minutes ago

Some multiplications are faster than others, as compilers will try to use additions, shifts, and the special address-offset computation instructions to avoid using the general-purpose mulitplication circuits. But I didn't notice any regularities in 1682554634 that would enable fast multiplication.