ctSwap

fnvoid 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 @safe

Swaps 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

doSwapSwap flag (0 = no swap, non-zero = swap).
aFirst value (may be modified).
bSecond value (may be modified).