mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8280459: Suspicious integer division in Hashtable.readHashtable
Reviewed-by: rriggs, bpb
This commit is contained in:
parent
9bf6ffa19f
commit
d1569111d7
1 changed files with 1 additions and 1 deletions
|
@ -1290,7 +1290,7 @@ public class Hashtable<K,V>
|
||||||
// no larger than the clamped original length. Make the length
|
// no larger than the clamped original length. Make the length
|
||||||
// odd if it's large enough, this helps distribute the entries.
|
// odd if it's large enough, this helps distribute the entries.
|
||||||
// Guard against the length ending up zero, that's not valid.
|
// Guard against the length ending up zero, that's not valid.
|
||||||
int length = (int)((elements + elements / 20) / lf) + 3;
|
int length = (int)(elements * 1.05f / lf) + 3;
|
||||||
if (length > elements && (length & 1) == 0)
|
if (length > elements && (length & 1) == 0)
|
||||||
length--;
|
length--;
|
||||||
length = Math.min(length, origlength);
|
length = Math.min(length, origlength);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue