if-else(byte)

xod/core/if-else(byte)

Outputs either input value depending on condition
if-else(byte)
@/if-else(byte)
Deprecated: Use the generic `xod/core/if-else` instead
Outputs either input value depending on condition
CONDboolean
Condition value
Tbyte
Value to be output if condition is true
Fbyte
Value to be output if condition is false
if-else(byte)
R
COND
T
F
Rbyte
Outputs value of `T` if `COND` is true, and `F` otherwise

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        auto cond = getValue<input_COND>(ctx);
        auto trueVal = getValue<input_T>(ctx);
        auto falseVal = getValue<input_F>(ctx);
        emitValue<output_R>(ctx, cond ? trueVal : falseVal);
    }
}

Tabular tests

CONDTFR
false00hFFhFFh
true00hFFh00h
false32d42d42d
true00001101b01001100b00001101b