8281259: MutableBigInteger subtraction could be simplified

Reviewed-by: bpb
This commit is contained in:
Daniel Jeliński 2022-02-11 16:24:43 +00:00 committed by Brian Burkhalter
parent f399ae558e
commit e73ee0ca10
2 changed files with 16 additions and 5 deletions

View file

@ -207,4 +207,15 @@ public class BigIntegers {
bh.consume(tmp);
}
}
/** Invokes the gcd method of BigInteger with different values. */
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public void testGcd(Blackhole bh) {
for (int i = 0; i < TESTSIZE; i++) {
BigInteger i1 = shiftArray[TESTSIZE - i - 1];
BigInteger i2 = shiftArray[i];
bh.consume(i2.gcd(i1));
}
}
}