androidx.ui.util

Classes

Float16

The Float16 class is a wrapper and a utility class to manipulate half-precision 16-bit IEEE 754 floating point data types (also called fp16 or binary16).

Top-level functions summary

Float
lerp(start: Float, stop: Float, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Int
lerp(start: Int, stop: Int, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Long
lerp(start: Long, stop: Long, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Float16
max(x: Float16, y: Float16)

Returns the larger of two half-precision float values (the value closest to positive infinity).

Float16
min(x: Float16, y: Float16)

Returns the smaller of two half-precision float values (the value closest to negative infinity).

Long
packFloats(val1: Float, val2: Float)

Packs two Float values into one Long value for use in inline classes.

Long
packInts(val1: Int, val2: Int)

Packs two Int values into one Long value for use in inline classes.

Float

Unpacks the first Float value in packFloats from its returned Long.

Float

Unpacks the second Float value in packFloats from its returned Long.

Int
unpackInt1(value: Long)

Unpacks the first Int value in packInts from its returned ULong.

Int
unpackInt2(value: Long)

Unpacks the second Int value in packInts from its returned ULong.

Extension functions summary

Top-level functions

lerp

fun lerp(
    start: Float,
    stop: Float,
    fraction: Float
): Float

Linearly interpolate between start and stop with fraction fraction between them.

lerp

fun lerp(
    start: Int,
    stop: Int,
    fraction: Float
): Int

Linearly interpolate between start and stop with fraction fraction between them.

lerp

fun lerp(
    start: Long,
    stop: Long,
    fraction: Float
): Long

Linearly interpolate between start and stop with fraction fraction between them.

max

fun max(
    x: Float16,
    y: Float16
): Float16

Returns the larger of two half-precision float values (the value closest to positive infinity). Special values are handled in the following ways:

Parameters
x: Float16 The first half-precision value
y: Float16 The second half-precision value
Return
The larger of the two specified half-precision values

min

fun min(
    x: Float16,
    y: Float16
): Float16

Returns the smaller of two half-precision float values (the value closest to negative infinity). Special values are handled in the following ways:

Parameters
x: Float16 The first half-precision value
y: Float16 The second half-precision value
Return
The smaller of the two specified half-precision values

packFloats

inline fun packFloats(
    val1: Float,
    val2: Float
): Long

Packs two Float values into one Long value for use in inline classes.

packInts

inline fun packInts(
    val1: Int,
    val2: Int
): Long

Packs two Int values into one Long value for use in inline classes.

unpackFloat1

inline fun unpackFloat1(value: Long): Float

Unpacks the first Float value in packFloats from its returned Long.

unpackFloat2

inline fun unpackFloat2(value: Long): Float

Unpacks the second Float value in packFloats from its returned Long.

unpackInt1

inline fun unpackInt1(value: Long): Int

Unpacks the first Int value in packInts from its returned ULong.

unpackInt2

inline fun unpackInt2(value: Long): Int

Unpacks the second Int value in packInts from its returned ULong.

Extension functions

toHexString

fun Int.toHexString(): String

toStringAsFixed

fun Float.toStringAsFixed(digits: Int): String