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

Method powMod

output/java_guava/1.4.19/LongMath.java:1269–1278  ·  view source on GitHub ↗

Returns a^p mod m.

(long a, long p, long m)

Source from the content-addressed store, hash-verified

1267 */
1268
1269private long powMod(long a, long p, long m) {
1270 long res = 1;
1271 for (; p != 0; p >>= 1) {
1272 if ((p & 1) != 0) {
1273 res = mulMod(res, a, m);
1274 }
1275 a = squareMod(a, m);
1276 }
1277 return res;
1278}
1279
1280 /**
1281 * 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