Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9d88dfa authored by Neil Fuller's avatar Neil Fuller
Browse files

Make Half class use public APIs

Half has a dependency on an internal sun.misc.FloatingDecimal
that can be replaced by an equivalent call on java.lang.Float
(which calls through to FloatingDecimal).

Any performance hit is worth it for a smaller API surface.

Bug: 111055375
Test: Build
Change-Id: Iecdf3aa9414922a77edbdc439b0c2b88033b3af8
parent 9916d4b3
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import android.annotation.HalfFloat;
import android.annotation.NonNull;
import android.annotation.Nullable;

import sun.misc.FloatingDecimal;

/**
 * <p>The {@code Half} class is a wrapper and a utility class to manipulate half-precision 16-bit
 * <a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">IEEE 754</a>
@@ -1026,7 +1024,7 @@ public final class Half extends Number implements Comparable<Half> {
     *         half-precision float value
     */
    public static @HalfFloat short parseHalf(@NonNull String s) throws NumberFormatException {
        return toHalf(FloatingDecimal.parseFloat(s));
        return toHalf(Float.parseFloat(s));
    }

    /**