|
inlineconstexpr |
Parameters
k
: integral constant whose bits are the result of a lookup table for the ternary operation. The consteval function mfb (make from bits) can be used to generate this constant from its bits (see below).u
, v
, w
, : first argument.Return value
a
and if any parameter is simd, its number of lanes is the number of lanes of the outputThe following table is the pattern of a truth table: if op
is a ternary bit operator the result column is the desired bit output when calling op
pn the x
, y
and z
bit values.
x | y | z | result |
---|---|---|---|
0 | 0 | 0 | a |
0 | 0 | 1 | b |
0 | 1 | 0 | c |
0 | 1 | 1 | d |
1 | 0 | 0 | e |
1 | 0 | 1 | f |
1 | 1 | 0 | g |
1 | 1 | 1 | h |
A programmer as only to supply the result column, i.e. defines values of bits a through h in a single 8-bit value
k = .(a << 7) + (b << 6) + (c << 5) + (d << 4) + (e << 3) + (f << 2) + (g << 1) + h
(the consteval function eve::truth_table
can be used to do that operation: see the example)