top | item 41762969

(no title)

meow_catrix | 1 year ago

The Amiga manual suggests normalizing to a conjunctive normal form.

discuss

order

bcoates|1 year ago

The constant-math method above doesn't require that and works on denormalized expressions, too.

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

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.