ctSwap
fn
void ctSwap(T)(uint doSwap, ref T a, ref T b) if (is(T == ubyte) || is(T == ushort) || is(T == uint) || is(T == ulong)) pure nothrow @nogc @safeSwaps two values conditionally in constant time.
If doSwap is non-zero, swaps the values of a and b. If doSwap is 0, leaves a and b unchanged. The operation is performed using XOR without branching.
Parameters
doSwap | Swap flag (0 = no swap, non-zero = swap). |
a | First value (may be modified). |
b | Second value (may be modified). |