classlib: get rid of call to Math.log

This commit is contained in:
Alexey Andreev 2023-12-07 19:55:47 +01:00
parent 953c475b46
commit facf3c496f

View File

@ -66,7 +66,7 @@ class TConversion {
return val.toString();
}
double bitsForRadixDigit;
bitsForRadixDigit = Math.log(radix) / Math.log(2);
bitsForRadixDigit = Integer.SIZE - Integer.numberOfLeadingZeros(radix) - 1;
int resLengthInChars = (int) (val.abs().bitLength() / bitsForRadixDigit + ((sign < 0) ? 1 : 0)) + 1;
char[] result = new char[resLengthInChars];