Zig NEWS

Discussion on: Using comptime to invert bijective functions on enums

 
rbino profile image
Riccardo Binetti

It's written by hand to give the intuition of how that works, but if you look at the output of the code on GodBolt and search into the assembly, you can see that the beats functions is never called, and the beatenBy functions is translated to a number of comparisons, jumps and movs of constant (the winners calculated at compile time).