ctSwapBit

fnvoid ctSwapBit(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

Conditionally swaps two integers using an already normalized bit.

Unlike ctSwap, this primitive deliberately accepts only zero or one, allowing the mask conversion to use unsigned subtraction without a comparison that an optimizer may lower to control flow.

Parameters

doSwapZero or one.
aFirst value.
bSecond value.