UByte

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalUnsignedTypes inline class UByte : 
    Comparable<UByte>

Functions

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

and

Performs a bitwise AND operation between the two values.

infix fun and(other: UByte): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

compareTo

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

operator fun compareTo(other: UByte): Int
operator fun compareTo(other: UShort): Int
operator fun compareTo(other: UInt): Int
operator fun compareTo(other: ULong): Int
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

dec

Decrements this value.

operator fun dec(): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

div

Divides this value by the other value.

operator fun div(other: UByte): UInt
operator fun div(other: UShort): UInt
operator fun div(other: UInt): UInt
operator fun div(other: ULong): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

inc

Increments this value.

operator fun inc(): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

inv

Inverts the bits in this value.

fun inv(): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

minus

Subtracts the other value from this value.

operator fun minus(other: UByte): UInt
operator fun minus(other: UShort): UInt
operator fun minus(other: UInt): UInt
operator fun minus(other: ULong): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

or

Performs a bitwise OR operation between the two values.

infix fun or(other: UByte): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

plus

Adds the other value to this value.

operator fun plus(other: UByte): UInt
operator fun plus(other: UShort): UInt
operator fun plus(other: UInt): UInt
operator fun plus(other: ULong): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

rangeTo

Creates a range from this value to the specified other value.

operator fun rangeTo(other: UByte): UIntRange
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

rem

Calculates the remainder of dividing this value by the other value.

operator fun rem(other: UByte): UInt
operator fun rem(other: UShort): UInt
operator fun rem(other: UInt): UInt
operator fun rem(other: ULong): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

times

Multiplies this value by the other value.

operator fun times(other: UByte): UInt
operator fun times(other: UShort): UInt
operator fun times(other: UInt): UInt
operator fun times(other: ULong): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toByte

Converts this UByte value to Byte.

fun toByte(): Byte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toDouble

Converts this UByte value to Double.

fun toDouble(): Double
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toFloat

Converts this UByte value to Float.

fun toFloat(): Float
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toInt

Converts this UByte value to Int.

fun toInt(): Int
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toLong

Converts this UByte value to Long.

fun toLong(): Long
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toShort

Converts this UByte value to Short.

fun toShort(): Short
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toString

Returns a string representation of the object.

fun toString(): String
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toUByte

Returns this value.

fun toUByte(): UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toUInt

Converts this UByte value to UInt.

fun toUInt(): UInt
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toULong

Converts this UByte value to ULong.

fun toULong(): ULong
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

toUShort

Converts this UByte value to UShort.

fun toUShort(): UShort
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

xor

Performs a bitwise XOR operation between the two values.

infix fun xor(other: UByte): UByte

Companion Object Properties

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

MAX_VALUE

A constant holding the maximum value an instance of UByte can have.

const val MAX_VALUE: UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

MIN_VALUE

A constant holding the minimum value an instance of UByte can have.

const val MIN_VALUE: UByte
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

SIZE_BITS

The number of bits used to represent an instance of UByte in a binary form.

const val SIZE_BITS: Int
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

SIZE_BYTES

The number of bytes used to represent an instance of UByte in a binary form.

const val SIZE_BYTES: Int

Extension Functions

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

coerceAtLeast

Ensures that this value is not less than the specified minimumValue.

fun UByte.coerceAtLeast(minimumValue: UByte): UByte
fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

coerceAtMost

Ensures that this value is not greater than the specified maximumValue.

fun UByte.coerceAtMost(maximumValue: UByte): UByte
fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

coerceIn

Ensures that this value lies in the specified range minimumValue..maximumValue.

fun UByte.coerceIn(
    minimumValue: UByte, 
    maximumValue: UByte
): UByte
fun <T : Comparable<T>> T.coerceIn(
    minimumValue: T?, 
    maximumValue: T?
): T

Ensures that this value lies in the specified range.

fun <T : Comparable<T>> T.coerceIn(
    range: ClosedFloatingPointRange<T>
): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
Platform and version requirements: Native (1.3)

convert

fun <R : Any> UByte.convert(): R
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)

countLeadingZeroBits

Counts the number of consecutive most significant bits that are zero in the binary representation of this UByte number.

fun UByte.countLeadingZeroBits(): Int
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)

countOneBits

Counts the number of set bits in the binary representation of this UByte number.

fun UByte.countOneBits(): Int
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)

countTrailingZeroBits

Counts the number of consecutive least significant bits that are zero in the binary representation of this UByte number.

fun UByte.countTrailingZeroBits(): Int
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

downTo

Returns a progression from this value down to the specified to value with the step -1.

infix fun UByte.downTo(to: UByte): UIntProgression
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

rangeTo

Creates a range from this Comparable value to the specified that value.

operator fun <T : Comparable<T>> T.rangeTo(
    that: T
): ClosedRange<T>
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

rotateLeft

Rotates the binary representation of this UByte number left by the specified bitCount number of bits. The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.

fun UByte.rotateLeft(bitCount: Int): UByte
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

rotateRight

Rotates the binary representation of this UByte number right by the specified bitCount number of bits. The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.

fun UByte.rotateRight(bitCount: Int): UByte
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)

takeHighestOneBit

Returns a number having a single bit set in the position of the most significant set bit of this UByte number, or zero, if this number is zero.

fun UByte.takeHighestOneBit(): UByte
Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)

takeLowestOneBit

Returns a number having a single bit set in the position of the least significant set bit of this UByte number, or zero, if this number is zero.

fun UByte.takeLowestOneBit(): UByte
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

toString

Returns a string representation of this Byte value in the specified radix.

fun UByte.toString(radix: Int): String
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

until

Returns a range from this value up to but excluding the specified to value.

infix fun UByte.until(to: UByte): UIntRange

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html