x to the power n, modulo m. The return type is the largest of x's and m's type.
The function requires that all values have unsigned types.
assert(powmod(1U, 10U, 3U) == 1); assert(powmod(3U, 2U, 6U) == 3); assert(powmod(5U, 5U, 15U) == 5); assert(powmod(2U, 3U, 5U) == 3); assert(powmod(2U, 4U, 5U) == 1); assert(powmod(2U, 5U, 5U) == 2);
Computes the value of a positive integer x, raised to the power n, modulo m.