MCPcopy Create free account
hub / github.com/antlr/codebuff / powMod

Method powMod

output/java_guava/1.4.16/LongMath.java:1288–1297  ·  view source on GitHub ↗

Returns a^p mod m.

(long a, long p, long m)

Source from the content-addressed store, hash-verified

1286 */
1287
1288private long powMod(long a, long p, long m) {
1289 long res = 1;
1290 for (; p != 0; p >>= 1) {
1291 if ((p & 1) != 0) {
1292 res = mulMod(res, a, m);
1293 }
1294 a = squareMod(a, m);
1295 }
1296 return res;
1297}
1298
1299 /**
1300 * Returns true if n is a strong probable prime relative to the specified base.

Callers 1

testWitnessMethod · 0.95

Calls 2

mulModMethod · 0.95
squareModMethod · 0.95

Tested by

no test coverage detected