Suppose you have four boolean variables A, B, C, and D. You can calculate X as the result from A, B, C assuming that D is false, and Y as the result assuming that D is true. Then, a third ternary operation can switch between X and Y depending on D. This creates a tree of 3 operations, which I suspect is the best you can do in the worst case.
For five or more arguments, this naturally extends into a tree, though it likely isn't the most efficient encoding.
bcoates|1 year ago
That said, the trick for turning four or more argument bitwise operations into a series of vpternlogd operations has yet to be posted
LegionMammal978|1 year ago
For five or more arguments, this naturally extends into a tree, though it likely isn't the most efficient encoding.