mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8286378: Address possibly lossy conversions in java.base
Reviewed-by: naoto, xuelei, bpb, alanb
This commit is contained in:
parent
0a6832b24c
commit
17c52789b7
32 changed files with 68 additions and 71 deletions
|
@ -720,7 +720,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||
if (numBytes > 0) {
|
||||
rnd.nextBytes(randomBits);
|
||||
int excessBits = 8*numBytes - numBits;
|
||||
randomBits[0] &= (1 << (8-excessBits)) - 1;
|
||||
randomBits[0] &= (byte)((1 << (8-excessBits)) - 1);
|
||||
}
|
||||
return randomBits;
|
||||
}
|
||||
|
@ -3389,7 +3389,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||
|
||||
// Mask out any excess bits
|
||||
int excessBits = (numInts << 5) - p;
|
||||
mag[0] &= (1L << (32-excessBits)) - 1;
|
||||
mag[0] &= (int)((1L << (32-excessBits)) - 1);
|
||||
|
||||
return (mag[0] == 0 ? new BigInteger(1, mag) : new BigInteger(mag, 1));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue