kotlin.ULong.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lightstep-opentelemetry-auto-exporter Show documentation
Show all versions of lightstep-opentelemetry-auto-exporter Show documentation
Lightstep OpenTelemetry Auto Exporter
The newest version!
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// Auto-generated file. DO NOT EDIT!
package kotlin
import kotlin.experimental.*
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public inline class ULong @PublishedApi internal constructor(@PublishedApi internal val data: Long) : Comparable {
companion object {
/**
* A constant holding the minimum value an instance of ULong can have.
*/
public const val MIN_VALUE: ULong = ULong(0)
/**
* A constant holding the maximum value an instance of ULong can have.
*/
public const val MAX_VALUE: ULong = ULong(-1)
/**
* The number of bytes used to represent an instance of ULong in a binary form.
*/
public const val SIZE_BYTES: Int = 8
/**
* The number of bits used to represent an instance of ULong in a binary form.
*/
public const val SIZE_BITS: Int = 64
}
/**
* 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.
*/
@kotlin.internal.InlineOnly
public inline operator fun compareTo(other: UByte): Int = this.compareTo(other.toULong())
/**
* 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.
*/
@kotlin.internal.InlineOnly
public inline operator fun compareTo(other: UShort): Int = this.compareTo(other.toULong())
/**
* 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.
*/
@kotlin.internal.InlineOnly
public inline operator fun compareTo(other: UInt): Int = this.compareTo(other.toULong())
/**
* 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.
*/
@kotlin.internal.InlineOnly
@Suppress("OVERRIDE_BY_INLINE")
public override inline operator fun compareTo(other: ULong): Int = ulongCompare(this.data, other.data)
/** Adds the other value to this value. */
@kotlin.internal.InlineOnly
public inline operator fun plus(other: UByte): ULong = this.plus(other.toULong())
/** Adds the other value to this value. */
@kotlin.internal.InlineOnly
public inline operator fun plus(other: UShort): ULong = this.plus(other.toULong())
/** Adds the other value to this value. */
@kotlin.internal.InlineOnly
public inline operator fun plus(other: UInt): ULong = this.plus(other.toULong())
/** Adds the other value to this value. */
@kotlin.internal.InlineOnly
public inline operator fun plus(other: ULong): ULong = ULong(this.data.plus(other.data))
/** Subtracts the other value from this value. */
@kotlin.internal.InlineOnly
public inline operator fun minus(other: UByte): ULong = this.minus(other.toULong())
/** Subtracts the other value from this value. */
@kotlin.internal.InlineOnly
public inline operator fun minus(other: UShort): ULong = this.minus(other.toULong())
/** Subtracts the other value from this value. */
@kotlin.internal.InlineOnly
public inline operator fun minus(other: UInt): ULong = this.minus(other.toULong())
/** Subtracts the other value from this value. */
@kotlin.internal.InlineOnly
public inline operator fun minus(other: ULong): ULong = ULong(this.data.minus(other.data))
/** Multiplies this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun times(other: UByte): ULong = this.times(other.toULong())
/** Multiplies this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun times(other: UShort): ULong = this.times(other.toULong())
/** Multiplies this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun times(other: UInt): ULong = this.times(other.toULong())
/** Multiplies this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun times(other: ULong): ULong = ULong(this.data.times(other.data))
/** Divides this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun div(other: UByte): ULong = this.div(other.toULong())
/** Divides this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun div(other: UShort): ULong = this.div(other.toULong())
/** Divides this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun div(other: UInt): ULong = this.div(other.toULong())
/** Divides this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun div(other: ULong): ULong = ulongDivide(this, other)
/** Calculates the remainder of dividing this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun rem(other: UByte): ULong = this.rem(other.toULong())
/** Calculates the remainder of dividing this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun rem(other: UShort): ULong = this.rem(other.toULong())
/** Calculates the remainder of dividing this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun rem(other: UInt): ULong = this.rem(other.toULong())
/** Calculates the remainder of dividing this value by the other value. */
@kotlin.internal.InlineOnly
public inline operator fun rem(other: ULong): ULong = ulongRemainder(this, other)
/** Increments this value. */
@kotlin.internal.InlineOnly
public inline operator fun inc(): ULong = ULong(data.inc())
/** Decrements this value. */
@kotlin.internal.InlineOnly
public inline operator fun dec(): ULong = ULong(data.dec())
/** Creates a range from this value to the specified [other] value. */
@kotlin.internal.InlineOnly
public inline operator fun rangeTo(other: ULong): ULongRange = ULongRange(this, other)
/** Shifts this value left by the [bitCount] number of bits. */
@kotlin.internal.InlineOnly
public inline infix fun shl(bitCount: Int): ULong = ULong(data shl bitCount)
/** Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros. */
@kotlin.internal.InlineOnly
public inline infix fun shr(bitCount: Int): ULong = ULong(data ushr bitCount)
/** Performs a bitwise AND operation between the two values. */
@kotlin.internal.InlineOnly
public inline infix fun and(other: ULong): ULong = ULong(this.data and other.data)
/** Performs a bitwise OR operation between the two values. */
@kotlin.internal.InlineOnly
public inline infix fun or(other: ULong): ULong = ULong(this.data or other.data)
/** Performs a bitwise XOR operation between the two values. */
@kotlin.internal.InlineOnly
public inline infix fun xor(other: ULong): ULong = ULong(this.data xor other.data)
/** Inverts the bits in this value. */
@kotlin.internal.InlineOnly
public inline fun inv(): ULong = ULong(data.inv())
/**
* Converts this [ULong] value to [Byte].
*
* If this value is less than or equals to [Byte.MAX_VALUE], the resulting `Byte` value represents
* the same numerical value as this `ULong`.
*
* The resulting `Byte` value is represented by the least significant 8 bits of this `ULong` value.
* Note that the resulting `Byte` value may be negative.
*/
@kotlin.internal.InlineOnly
public inline fun toByte(): Byte = data.toByte()
/**
* Converts this [ULong] value to [Short].
*
* If this value is less than or equals to [Short.MAX_VALUE], the resulting `Short` value represents
* the same numerical value as this `ULong`.
*
* The resulting `Short` value is represented by the least significant 16 bits of this `ULong` value.
* Note that the resulting `Short` value may be negative.
*/
@kotlin.internal.InlineOnly
public inline fun toShort(): Short = data.toShort()
/**
* Converts this [ULong] value to [Int].
*
* If this value is less than or equals to [Int.MAX_VALUE], the resulting `Int` value represents
* the same numerical value as this `ULong`.
*
* The resulting `Int` value is represented by the least significant 32 bits of this `ULong` value.
* Note that the resulting `Int` value may be negative.
*/
@kotlin.internal.InlineOnly
public inline fun toInt(): Int = data.toInt()
/**
* Converts this [ULong] value to [Long].
*
* If this value is less than or equals to [Long.MAX_VALUE], the resulting `Long` value represents
* the same numerical value as this `ULong`. Otherwise the result is negative.
*
* The resulting `Long` value has the same binary representation as this `ULong` value.
*/
@kotlin.internal.InlineOnly
public inline fun toLong(): Long = data
/**
* Converts this [ULong] value to [UByte].
*
* If this value is less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents
* the same numerical value as this `ULong`.
*
* The resulting `UByte` value is represented by the least significant 8 bits of this `ULong` value.
*/
@kotlin.internal.InlineOnly
public inline fun toUByte(): UByte = data.toUByte()
/**
* Converts this [ULong] value to [UShort].
*
* If this value is less than or equals to [UShort.MAX_VALUE], the resulting `UShort` value represents
* the same numerical value as this `ULong`.
*
* The resulting `UShort` value is represented by the least significant 16 bits of this `ULong` value.
*/
@kotlin.internal.InlineOnly
public inline fun toUShort(): UShort = data.toUShort()
/**
* Converts this [ULong] value to [UInt].
*
* If this value is less than or equals to [UInt.MAX_VALUE], the resulting `UInt` value represents
* the same numerical value as this `ULong`.
*
* The resulting `UInt` value is represented by the least significant 32 bits of this `ULong` value.
*/
@kotlin.internal.InlineOnly
public inline fun toUInt(): UInt = data.toUInt()
/** Returns this value. */
@kotlin.internal.InlineOnly
public inline fun toULong(): ULong = this
/**
* Converts this [ULong] value to [Float].
*
* The resulting value is the closest `Float` to this `ULong` value.
* In case when this `ULong` value is exactly between two `Float`s,
* the one with zero at least significant bit of mantissa is selected.
*/
@kotlin.internal.InlineOnly
public inline fun toFloat(): Float = this.toDouble().toFloat()
/**
* Converts this [ULong] value to [Double].
*
* The resulting value is the closest `Double` to this `ULong` value.
* In case when this `ULong` value is exactly between two `Double`s,
* the one with zero at least significant bit of mantissa is selected.
*/
@kotlin.internal.InlineOnly
public inline fun toDouble(): Double = ulongToDouble(data)
public override fun toString(): String = ulongToString(data)
}
/**
* Converts this [Byte] value to [ULong].
*
* If this value is positive, the resulting `ULong` value represents the same numerical value as this `Byte`.
*
* The least significant 8 bits of the resulting `ULong` value are the same as the bits of this `Byte` value,
* whereas the most significant 56 bits are filled with the sign bit of this value.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Byte.toULong(): ULong = ULong(this.toLong())
/**
* Converts this [Short] value to [ULong].
*
* If this value is positive, the resulting `ULong` value represents the same numerical value as this `Short`.
*
* The least significant 16 bits of the resulting `ULong` value are the same as the bits of this `Short` value,
* whereas the most significant 48 bits are filled with the sign bit of this value.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Short.toULong(): ULong = ULong(this.toLong())
/**
* Converts this [Int] value to [ULong].
*
* If this value is positive, the resulting `ULong` value represents the same numerical value as this `Int`.
*
* The least significant 32 bits of the resulting `ULong` value are the same as the bits of this `Int` value,
* whereas the most significant 32 bits are filled with the sign bit of this value.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Int.toULong(): ULong = ULong(this.toLong())
/**
* Converts this [Long] value to [ULong].
*
* If this value is positive, the resulting `ULong` value represents the same numerical value as this `Long`.
*
* The resulting `ULong` value has the same binary representation as this `Long` value.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Long.toULong(): ULong = ULong(this)
/**
* Converts this [Float] value to [ULong].
*
* The fractional part, if any, is rounded down.
* Returns zero if this `Float` value is negative or `NaN`, [ULong.MAX_VALUE] if it's bigger than `ULong.MAX_VALUE`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Float.toULong(): ULong = doubleToULong(this.toDouble())
/**
* Converts this [Double] value to [ULong].
*
* The fractional part, if any, is rounded down.
* Returns zero if this `Double` value is negative or `NaN`, [ULong.MAX_VALUE] if it's bigger than `ULong.MAX_VALUE`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun Double.toULong(): ULong = doubleToULong(this)