Saturate.onLowerBound

T onLowerBound(Rhs, T)(Rhs, T bound)

Implements saturation for operators `+=`, `-=`, `*=`, `/=`, `%=`, `^^=`, `&=`, `|=`, `^=`, `<<=`, `>>=`, and `>>>=`. This hook is called if the result of the binary operation does not fit in Lhs without loss of information or a change in sign.

Parameters

RhsThe right-hand side type in the assignment, after the operation has been computed
boundThe bound being violated

Returns

Lhs.max if rhs >= 0, Lhs.min otherwise.