mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8342693: Use byte[] as parameter in a FDBigInteger constructor and as field
Reviewed-by: darcy
This commit is contained in:
parent
2b57f402c4
commit
8523880f06
3 changed files with 13 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2024, 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
|
||||
|
@ -217,7 +217,7 @@ public /*@ spec_bigint_math @*/ class FDBigInteger {
|
|||
@ requires (\forall int i; 0 <= i && i < nDigits; '0' <= digits[i] && digits[i] <= '9');
|
||||
@ ensures this.value() == \old(lValue * pow10(nDigits - kDigits) + (\sum int i; kDigits <= i && i < nDigits; (digits[i] - '0') * pow10(nDigits - i - 1)));
|
||||
@*/
|
||||
public FDBigInteger(long lValue, char[] digits, int kDigits, int nDigits) {
|
||||
public FDBigInteger(long lValue, byte[] digits, int kDigits, int nDigits) {
|
||||
int n = Math.max((nDigits + 8) / 9, 2); // estimate size needed.
|
||||
data = new int[n]; // allocate enough space
|
||||
data[0] = (int) lValue; // starting value
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2024, 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
|
||||
|
@ -1034,10 +1034,10 @@ public class FloatingDecimal{
|
|||
static class ASCIIToBinaryBuffer implements ASCIIToBinaryConverter {
|
||||
boolean isNegative;
|
||||
int decExponent;
|
||||
char digits[];
|
||||
byte[] digits;
|
||||
int nDigits;
|
||||
|
||||
ASCIIToBinaryBuffer( boolean negSign, int decExponent, char[] digits, int n)
|
||||
ASCIIToBinaryBuffer( boolean negSign, int decExponent, byte[] digits, int n)
|
||||
{
|
||||
this.isNegative = negSign;
|
||||
this.decExponent = decExponent;
|
||||
|
@ -1872,7 +1872,7 @@ public class FloatingDecimal{
|
|||
}
|
||||
} // look for and process decimal floating-point string
|
||||
|
||||
char[] digits = new char[ len ];
|
||||
byte[] digits = new byte[ len ];
|
||||
boolean decSeen = false;
|
||||
int nDigits = 0;
|
||||
int decPt = 0;
|
||||
|
@ -1903,10 +1903,10 @@ public class FloatingDecimal{
|
|||
while (i < len) {
|
||||
c = in.charAt(i);
|
||||
if (c >= '1' && c <= '9') {
|
||||
digits[nDigits++] = c;
|
||||
digits[nDigits++] = (byte) c;
|
||||
nTrailZero = 0;
|
||||
} else if (c == '0') {
|
||||
digits[nDigits++] = c;
|
||||
digits[nDigits++] = (byte) c;
|
||||
nTrailZero++;
|
||||
} else if (c == '.') {
|
||||
if (decSeen) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue