mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +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
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -142,9 +142,9 @@ public class BitArray {
|
|||
int bit = position(index);
|
||||
|
||||
if (value) {
|
||||
repn[idx] |= bit;
|
||||
repn[idx] |= (byte) bit;
|
||||
} else {
|
||||
repn[idx] &= ~bit;
|
||||
repn[idx] &= (byte) ~bit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -717,7 +717,7 @@ public class DerValue {
|
|||
byte[] retval = Arrays.copyOfRange(buffer, start + 1, end);
|
||||
if (numOfPadBits != 0) {
|
||||
// get rid of the padding bits
|
||||
retval[end - start - 2] &= (0xff << numOfPadBits);
|
||||
retval[end - start - 2] &= (byte)((0xff << numOfPadBits));
|
||||
}
|
||||
data.pos = data.end; // Compatibility. Reach end.
|
||||
return retval;
|
||||
|
|
|
@ -524,10 +524,10 @@ public final class ObjectIdentifier implements Serializable {
|
|||
|
||||
// and move them!
|
||||
out[opos/ow] |= // paste!
|
||||
(((in[ioffset+ipos/iw]+256) // locate the byte (+256 so that it's never negative)
|
||||
(byte)((((in[ioffset+ipos/iw]+256) // locate the byte (+256 so that it's never negative)
|
||||
>> (iw-ipos%iw-count)) & // move to the end of a byte
|
||||
((1 << (count))-1)) // zero out all other bits
|
||||
<< (ow-opos%ow-count); // move to the output position
|
||||
<< (ow-opos%ow-count)); // move to the output position
|
||||
ipos += count; // advance
|
||||
opos += count; // advance
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ public final class ObjectIdentifier implements Serializable {
|
|||
if (pack[i] != 0) {
|
||||
firstNonZero = i;
|
||||
}
|
||||
pack[i] |= 0x80;
|
||||
pack[i] |= (byte)0x80;
|
||||
}
|
||||
System.arraycopy(pack, firstNonZero,
|
||||
out, ooffset, pack.length-firstNonZero);
|
||||
|
|
|
@ -420,8 +420,8 @@ public abstract sealed class IntegerPolynomial implements IntegerFieldModuloP
|
|||
int bitsAdded = bitsPerLimb - bitPos;
|
||||
int bitsLeft = 8 - bitsAdded;
|
||||
|
||||
dst[dstIndex] += (curLimbValue & (0xFF >> bitsAdded))
|
||||
<< bitsAdded;
|
||||
dst[dstIndex] += (byte) ((curLimbValue & (0xFF >> bitsAdded))
|
||||
<< bitsAdded);
|
||||
curLimbValue >>= bitsLeft;
|
||||
bitPos = bitsLeft;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue