From facf3c496fd82f61a6cfea4e30e2da80bd1d3732 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 7 Dec 2023 19:55:47 +0100 Subject: [PATCH] classlib: get rid of call to Math.log --- .../src/main/java/org/teavm/classlib/java/math/TConversion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/math/TConversion.java b/classlib/src/main/java/org/teavm/classlib/java/math/TConversion.java index 988b2d86a..ca2b334f8 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/math/TConversion.java +++ b/classlib/src/main/java/org/teavm/classlib/java/math/TConversion.java @@ -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];