Hacker News new | ask | show | jobs
by d23 1702 days ago
Cool post! Thanks for submitting. I would never in a million years have thought to try out a polynomial fit for something like this. Unsurprisingly, it was slower, but still cool to even see you thinking that way at all.
1 comments

While I'm big on lookup tables for jobs like this, I'd have reached for bitmasks long before that polynomial...
Hard to compete with a 4-byte lookup table, but for decoding the 256-byte table can become: return ((dibit | (dibit -1))>>1) & 3;