Skip to content

Commit f094f3e

Browse files
committed
Fix PMD useless parentheses violations
1 parent c448ffb commit f094f3e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/thealgorithms/maths/DiscreteLogarithmBSGS.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static long discreteLog(long a, long b, long m) {
4141
long value = 1;
4242
for (long i = 0; i < n; i++) {
4343
babySteps.put(value, i);
44-
value = (value * a) % m;
44+
value = value * a % m; // PMD fix
4545
}
4646

4747
long factor = modPow(a, m - n - 1, m);
@@ -51,7 +51,7 @@ public static long discreteLog(long a, long b, long m) {
5151
if (babySteps.containsKey(gamma)) {
5252
return j * n + babySteps.get(gamma);
5353
}
54-
gamma = (gamma * factor) % m;
54+
gamma = gamma * factor % m; // PMD fix
5555
}
5656

5757
return -1; // no solution
@@ -64,9 +64,9 @@ public static long modPow(long base, long exp, long mod) {
6464

6565
while (exp > 0) {
6666
if ((exp & 1) == 1) {
67-
result = (result * base) % mod;
67+
result = result * base % mod; // PMD fix
6868
}
69-
base = (base * base) % mod;
69+
base = base * base % mod; // PMD fix
7070
exp >>= 1;
7171
}
7272
return result;

0 commit comments

Comments
 (0)