Cool stuff! And with C++ constexpr, or equivalents like Zig comptime, you could replace the magic numbers in the table with the logic that computes them, making the code clearer and removing the possibility of mistakes. (Ive been falling in love with compile-time computation lately.)
I wasn’t expecting to be impressed, but I was. Maybe lookup tables are an underappreciated branch of computer science, I don’t know. So few instructions!