Long

Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type long.

Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type long.

Represents a 64-bit signed integer.

Types

Link copied to clipboard
object Companion
object Companion
object Companion

Functions

Link copied to clipboard
infix fun and(other: Long): Long

Performs a bitwise AND operation between the two values.

infix fun and(other: Long): Long

Performs a bitwise AND operation between the two values.

infix external fun and(other: Long): Long

Performs a bitwise AND operation between the two values.

Link copied to clipboard
operator fun compareTo(other: Byte): Int
operator fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
open operator override fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

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: Byte): Int
operator fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
open operator override fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

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.

inline operator fun compareTo(other: Byte): Int
inline operator fun compareTo(other: Double): Int
inline operator fun compareTo(other: Float): Int
inline operator fun compareTo(other: Int): Int
open operator external override fun compareTo(other: Long): Int
inline operator fun compareTo(other: Short): Int

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.

Link copied to clipboard
operator fun dec(): Long

Decrements this value.

operator fun dec(): Long

Decrements this value.

operator external fun dec(): Long

Decrements this value.

Link copied to clipboard
operator fun div(other: Byte): Long
operator fun div(other: Int): Long
operator fun div(other: Long): Long
operator fun div(other: Short): Long

Divides this value by the other value, truncating the result to an integer that is closer to zero.

operator fun div(other: Double): Double
operator fun div(other: Float): Float

Divides this value by the other value.

operator fun div(other: Byte): Long
operator fun div(other: Int): Long
operator fun div(other: Long): Long
operator fun div(other: Short): Long

Divides this value by the other value, truncating the result to an integer that is closer to zero.

operator fun div(other: Double): Double
operator fun div(other: Float): Float

Divides this value by the other value.

inline operator fun div(other: Byte): Long
inline operator fun div(other: Int): Long
operator external fun div(other: Long): Long
inline operator fun div(other: Short): Long

Divides this value by the other value, truncating the result to an integer that is closer to zero.

inline operator fun div(other: Double): Double
inline operator fun div(other: Float): Float

Divides this value by the other value.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
fun equals(other: Long): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun inc(): Long

Increments this value.

operator fun inc(): Long

Increments this value.

operator external fun inc(): Long

Increments this value.

Link copied to clipboard
fun inv(): Long

Inverts the bits in this value.

fun inv(): Long

Inverts the bits in this value.

external fun inv(): Long

Inverts the bits in this value.

Link copied to clipboard
operator fun minus(other: Byte): Long
operator fun minus(other: Double): Double
operator fun minus(other: Float): Float
operator fun minus(other: Int): Long
operator fun minus(other: Long): Long
operator fun minus(other: Short): Long

Subtracts the other value from this value.

operator fun minus(other: Byte): Long
operator fun minus(other: Double): Double
operator fun minus(other: Float): Float
operator fun minus(other: Int): Long
operator fun minus(other: Long): Long
operator fun minus(other: Short): Long

Subtracts the other value from this value.

inline operator fun minus(other: Byte): Long
inline operator fun minus(other: Double): Double
inline operator fun minus(other: Float): Float
inline operator fun minus(other: Int): Long
operator external fun minus(other: Long): Long
inline operator fun minus(other: Short): Long

Subtracts the other value from this value.

Link copied to clipboard
infix fun or(other: Long): Long

Performs a bitwise OR operation between the two values.

infix fun or(other: Long): Long

Performs a bitwise OR operation between the two values.

infix external fun or(other: Long): Long

Performs a bitwise OR operation between the two values.

Link copied to clipboard
operator fun plus(other: Byte): Long
operator fun plus(other: Double): Double
operator fun plus(other: Float): Float
operator fun plus(other: Int): Long
operator fun plus(other: Long): Long
operator fun plus(other: Short): Long

Adds the other value to this value.

operator fun plus(other: Byte): Long
operator fun plus(other: Double): Double
operator fun plus(other: Float): Float
operator fun plus(other: Int): Long
operator fun plus(other: Long): Long
operator fun plus(other: Short): Long

Adds the other value to this value.

inline operator fun plus(other: Byte): Long
inline operator fun plus(other: Double): Double
inline operator fun plus(other: Float): Float
inline operator fun plus(other: Int): Long
operator external fun plus(other: Long): Long
inline operator fun plus(other: Short): Long

Adds the other value to this value.

Link copied to clipboard
operator fun rangeTo(other: Byte): LongRange
operator fun rangeTo(other: Int): LongRange
operator fun rangeTo(other: Long): LongRange
operator fun rangeTo(other: Short): LongRange

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

operator fun rangeTo(other: Byte): LongRange
operator fun rangeTo(other: Int): LongRange
operator fun rangeTo(other: Long): LongRange
operator fun rangeTo(other: Short): LongRange

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

operator fun rangeTo(other: Byte): LongRange
operator fun rangeTo(other: Int): LongRange
operator fun rangeTo(other: Long): LongRange
operator fun rangeTo(other: Short): LongRange

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

Link copied to clipboard
operator fun rem(other: Byte): Long
operator fun rem(other: Double): Double
operator fun rem(other: Float): Float
operator fun rem(other: Int): Long
operator fun rem(other: Long): Long
operator fun rem(other: Short): Long

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
operator fun rem(other: Byte): Long
operator fun rem(other: Double): Double
operator fun rem(other: Float): Float
operator fun rem(other: Int): Long
operator fun rem(other: Long): Long
operator fun rem(other: Short): Long

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
inline operator fun rem(other: Byte): Long
inline operator fun rem(other: Double): Double
inline operator fun rem(other: Float): Float
inline operator fun rem(other: Int): Long
operator external fun rem(other: Long): Long
inline operator fun rem(other: Short): Long

Calculates the remainder of truncating division of this value by the other value.

Link copied to clipboard
infix fun shl(bitCount: Int): Long

Shifts this value left by the bitCount number of bits.

infix fun shl(bitCount: Int): Long

Shifts this value left by the bitCount number of bits.

infix external fun shl(bitCount: Int): Long

Shifts this value left by the bitCount number of bits.

Link copied to clipboard
infix fun shr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with copies of the sign bit.

infix fun shr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with copies of the sign bit.

infix external fun shr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with copies of the sign bit.

Link copied to clipboard
operator fun times(other: Byte): Long
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Long
operator fun times(other: Long): Long
operator fun times(other: Short): Long

Multiplies this value by the other value.

operator fun times(other: Byte): Long
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Long
operator fun times(other: Long): Long
operator fun times(other: Short): Long

Multiplies this value by the other value.

inline operator fun times(other: Byte): Long
inline operator fun times(other: Double): Double
inline operator fun times(other: Float): Float
inline operator fun times(other: Int): Long
operator external fun times(other: Long): Long
inline operator fun times(other: Short): Long

Multiplies this value by the other value.

Link copied to clipboard
open override fun toByte(): Byte

Converts this Long value to Byte.

open override fun toByte(): Byte

Converts this Long value to Byte.

open external override fun toByte(): Byte

Converts this Long value to Byte.

Link copied to clipboard
open override fun toChar(): Char

Converts this Long value to Char.

open override fun toChar(): Char

Converts this Long value to Char.

open external override fun toChar(): Char

Converts this Long value to Char.

Link copied to clipboard
open override fun toDouble(): Double

Converts this Long value to Double.

open override fun toDouble(): Double

Converts this Long value to Double.

open external override fun toDouble(): Double

Converts this Long value to Double.

Link copied to clipboard
open override fun toFloat(): Float

Converts this Long value to Float.

open override fun toFloat(): Float

Converts this Long value to Float.

open external override fun toFloat(): Float

Converts this Long value to Float.

Link copied to clipboard
open override fun toInt(): Int

Converts this Long value to Int.

open override fun toInt(): Int

Converts this Long value to Int.

open external override fun toInt(): Int

Converts this Long value to Int.

Link copied to clipboard
open override fun toLong(): Long

Returns this value.

open override fun toLong(): Long

Returns this value.

open inline override fun toLong(): Long

Returns this value.

Link copied to clipboard
open override fun toShort(): Short

Converts this Long value to Short.

open override fun toShort(): Short

Converts this Long value to Short.

open external override fun toShort(): Short

Converts this Long value to Short.

Link copied to clipboard
open external override fun toString(): String
Link copied to clipboard
operator fun unaryMinus(): Long

Returns the negative of this value.

operator fun unaryMinus(): Long

Returns the negative of this value.

operator external fun unaryMinus(): Long

Returns the negative of this value.

Link copied to clipboard
operator fun unaryPlus(): Long

Returns this value.

operator fun unaryPlus(): Long

Returns this value.

inline operator fun unaryPlus(): Long

Returns this value.

Link copied to clipboard
infix fun ushr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with zeros.

infix fun ushr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with zeros.

infix external fun ushr(bitCount: Int): Long

Shifts this value right by the bitCount number of bits, filling the leftmost bits with zeros.

Link copied to clipboard
infix fun xor(other: Long): Long

Performs a bitwise XOR operation between the two values.

infix fun xor(other: Long): Long

Performs a bitwise XOR operation between the two values.

infix external fun xor(other: Long): Long

Performs a bitwise XOR operation between the two values.

Extensions

Link copied to clipboard
expect val Long.absoluteValue: Long
expect val Long.absoluteValue: Long
expect val Long.absoluteValue: Long

Returns the absolute value of this value.

actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long

Returns the absolute value of this value.

actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long

Returns the absolute value of this value.

actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long
actual val Long.absoluteValue: Long

Returns the absolute value of this value.

Link copied to clipboard
fun Long.coerceAtLeast(minimumValue: Long): Long
fun Long.coerceAtLeast(minimumValue: Long): Long
fun Long.coerceAtLeast(minimumValue: Long): Long

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

Link copied to clipboard
fun Long.coerceAtMost(maximumValue: Long): Long
fun Long.coerceAtMost(maximumValue: Long): Long
fun Long.coerceAtMost(maximumValue: Long): Long

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

Link copied to clipboard
fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long
fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long
fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long

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

Ensures that this value lies in the specified range.

Link copied to clipboard
inline external fun <R : Any> Long.convert(): R
inline external fun <R : Any> Long.convert(): R
inline external fun <R : Any> Long.convert(): R
Link copied to clipboard

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

actual inline fun Long.countLeadingZeroBits(): Int
actual inline fun Long.countLeadingZeroBits(): Int
actual inline fun Long.countLeadingZeroBits(): Int

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

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

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

Link copied to clipboard
expect fun Long.countOneBits(): Int
expect fun Long.countOneBits(): Int
expect fun Long.countOneBits(): Int

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

actual inline fun Long.countOneBits(): Int
actual inline fun Long.countOneBits(): Int
actual inline fun Long.countOneBits(): Int

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

actual fun Long.countOneBits(): Int
actual fun Long.countOneBits(): Int
actual fun Long.countOneBits(): Int

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

actual external fun Long.countOneBits(): Int
actual external fun Long.countOneBits(): Int
actual external fun Long.countOneBits(): Int

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

Link copied to clipboard

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

actual inline fun Long.countTrailingZeroBits(): Int
actual inline fun Long.countTrailingZeroBits(): Int
actual inline fun Long.countTrailingZeroBits(): Int

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

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

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

Link copied to clipboard
Link copied to clipboard
infix fun Long.downTo(to: Int): LongProgression
infix fun Long.downTo(to: Int): LongProgression
infix fun Long.downTo(to: Int): LongProgression

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

Link copied to clipboard
inline fun Long.floorDiv(other: Byte): Long
inline fun Long.floorDiv(other: Short): Long
inline fun Long.floorDiv(other: Int): Long
inline fun Long.floorDiv(other: Long): Long
inline fun Long.floorDiv(other: Byte): Long
inline fun Long.floorDiv(other: Short): Long
inline fun Long.floorDiv(other: Int): Long
inline fun Long.floorDiv(other: Long): Long
inline fun Long.floorDiv(other: Byte): Long
inline fun Long.floorDiv(other: Short): Long
inline fun Long.floorDiv(other: Int): Long
inline fun Long.floorDiv(other: Long): Long

Divides this value by the other value, flooring the result to an integer that is closer to negative infinity.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun Long.mod(other: Byte): Byte
inline fun Long.mod(other: Short): Short
inline fun Long.mod(other: Int): Int
inline fun Long.mod(other: Long): Long
inline fun Long.mod(other: Byte): Byte
inline fun Long.mod(other: Short): Short
inline fun Long.mod(other: Int): Int
inline fun Long.mod(other: Long): Long
inline fun Long.mod(other: Byte): Byte
inline fun Long.mod(other: Short): Short
inline fun Long.mod(other: Int): Int
inline fun Long.mod(other: Long): Long

Calculates the remainder of flooring division of this value by the other value.

Link copied to clipboard
Link copied to clipboard
inline external fun <R : Number> Number.narrow(): R
inline external fun <R : Number> Number.narrow(): R
inline external fun <R : Number> Number.narrow(): R
Link copied to clipboard

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual inline fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateLeft(bitCount: Int): Long

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long
@ExperimentalStdlibApi
actual fun Long.rotateLeft(bitCount: Int): Long

Rotates the binary representation of this Long 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.

Link copied to clipboard

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long

Rotates the binary representation of this Long 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.

@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long
@ExperimentalStdlibApi
actual inline fun Long.rotateRight(bitCount: Int): Long

Rotates the binary representation of this Long 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.

Link copied to clipboard
Link copied to clipboard
expect val Long.sign: Int
expect val Long.sign: Int
expect val Long.sign: Int

Returns the sign of this value:

actual val Long.sign: Int
actual val Long.sign: Int
actual val Long.sign: Int

Returns the sign of this value:

actual val Long.sign: Int
actual val Long.sign: Int
actual val Long.sign: Int

Returns the sign of this value:

actual val Long.sign: Int
actual val Long.sign: Int
actual val Long.sign: Int

Returns the sign of this value:

Link copied to clipboard
inline external fun <R : Number> Number.signExtend(): R
inline external fun <R : Number> Number.signExtend(): R
inline external fun <R : Number> Number.signExtend(): R
Link copied to clipboard

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

actual inline fun Long.takeHighestOneBit(): Long
actual inline fun Long.takeHighestOneBit(): Long
actual inline fun Long.takeHighestOneBit(): Long

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

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

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

Link copied to clipboard
expect fun Long.takeLowestOneBit(): Long
expect fun Long.takeLowestOneBit(): Long
expect fun Long.takeLowestOneBit(): Long

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

actual inline fun Long.takeLowestOneBit(): Long
actual inline fun Long.takeLowestOneBit(): Long
actual inline fun Long.takeLowestOneBit(): Long

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

actual fun Long.takeLowestOneBit(): Long
actual fun Long.takeLowestOneBit(): Long
actual fun Long.takeLowestOneBit(): Long

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

actual fun Long.takeLowestOneBit(): Long
actual fun Long.takeLowestOneBit(): Long
actual fun Long.takeLowestOneBit(): Long

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

Link copied to clipboard
inline fun Long.toBigDecimal(mathContext: MathContext): BigDecimal
inline fun Long.toBigDecimal(mathContext: MathContext): BigDecimal
inline fun Long.toBigDecimal(mathContext: MathContext): BigDecimal

Returns the value of this Long number as a BigDecimal.

Link copied to clipboard

Returns the value of this Long number as a BigInteger.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect fun Long.toString(radix: Int): String
expect fun Long.toString(radix: Int): String
expect fun Long.toString(radix: Int): String

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

actual inline fun Long.toString(radix: Int): String
actual inline fun Long.toString(radix: Int): String
actual inline fun Long.toString(radix: Int): String

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

actual fun Long.toString(radix: Int): String
actual fun Long.toString(radix: Int): String
actual fun Long.toString(radix: Int): String

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

actual inline fun Long.toString(radix: Int): String
actual inline fun Long.toString(radix: Int): String
actual inline fun Long.toString(radix: Int): String

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

Link copied to clipboard
inline fun Long.toUByte(): UByte
inline fun Long.toUByte(): UByte
inline fun Long.toUByte(): UByte

Converts this Long value to UByte.

Link copied to clipboard
inline fun Long.toUInt(): UInt
inline fun Long.toUInt(): UInt
inline fun Long.toUInt(): UInt

Converts this Long value to UInt.

Link copied to clipboard
inline fun Long.toULong(): ULong
inline fun Long.toULong(): ULong
inline fun Long.toULong(): ULong

Converts this Long value to ULong.

Link copied to clipboard
inline fun Long.toUShort(): UShort
inline fun Long.toUShort(): UShort
inline fun Long.toUShort(): UShort

Converts this Long value to UShort.

Link copied to clipboard
infix fun Long.until(to: Byte): LongRange
infix fun Long.until(to: Int): LongRange
infix fun Long.until(to: Long): LongRange
infix fun Long.until(to: Short): LongRange
infix fun Long.until(to: Byte): LongRange
infix fun Long.until(to: Int): LongRange
infix fun Long.until(to: Long): LongRange
infix fun Long.until(to: Short): LongRange
infix fun Long.until(to: Byte): LongRange
infix fun Long.until(to: Int): LongRange
infix fun Long.until(to: Long): LongRange
infix fun Long.until(to: Short): LongRange

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