numeric.int.operator.modular ≡
Copyright: (c) Microsoft Corporation. All rights reserved.
Modular arithmetic operators.
template <typename T, typename U, auto M = (1 << bitsizeof(T))> inline auto add(T a, U b) §
Returns (a + b) mod M. a and b
must be less than M.
Parameters
-
typename TType of the first operand. Must be unsigned.
-
typename UType of the second operand. Must be unsigned.
-
auto M = (1 << bitsizeof(T))
Modulus value.
template <typename T, auto M = (1 << bitsizeof(T))> inline auto increment(T a) §
Returns (a + 1) mod M. a must be less than
M.
Parameters
-
typename TType of the operand. Must be unsigned.
-
auto M = (1 << bitsizeof(T))
Modulus value.
template <typename T, auto M = (1 << bitsizeof(T))> inline auto increment_if(T a, bool b) §
If b is true, then returns (a + 1) mod M.
returns a otherwise. a must be less than
M.
template <typename T, typename U, auto M = (1 << bitsizeof(T))> inline auto sub(T a, U b) §
Returns (a - b) mod M. a and b
must be less than M.
Parameters
-
typename TType of the first operand. Must be unsigned.
-
typename UType of the second operand. Must be unsigned.
-
auto M = (1 << bitsizeof(T))
Modulus value.
template <typename T, auto M = (1 << bitsizeof(T))> inline auto decrement(T a) §
Returns (a - 1) mod M. a must be less than
M.
Parameters
-
typename TType of the operand. Must be unsigned.
-
auto M = (1 << bitsizeof(T))
Modulus value.
template <typename T, auto M = (1 << bitsizeof(T))> inline auto decrement_if(T a, bool b) §
If b is true, then returns (a - 1) mod M.
returns a otherwise. a must be less than
M.