ctSelect

fnT ctSelect(T)(uint condition, T a, T b) if (is(T == ubyte) || is(T == ushort) || is(T == uint) || is(T == ulong)) pure nothrow @nogc @safe

Selects between two values in constant time.

Returns a if condition is 0, or b if condition is non-zero. The selection is performed using bitwise operations without branching.

Parameters

conditionSelection flag (0 selects a, non-zero selects b).
aValue returned when condition is 0.
bValue returned when condition is non-zero.

Returns

a if condition is 0, b otherwise.