rangeUntil member operator in builtins #KT-52933

This commit is contained in:
Ilya Gorbunov
2022-08-11 00:41:04 +02:00
committed by Space
parent ec9c862034
commit 203a00151d
23 changed files with 1109 additions and 97 deletions
@@ -237,6 +237,16 @@ public value class UByte @kotlin.internal.IntrinsicConstEvaluation @PublishedApi
@kotlin.internal.InlineOnly
public inline operator fun rangeTo(other: UByte): UIntRange = UIntRange(this.toUInt(), other.toUInt())
/**
* Creates a range from this value up to but excluding the specified [other] value.
*
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
public inline operator fun rangeUntil(other: UByte): UIntRange = this.toUInt() until other.toUInt()
/** Performs a bitwise AND operation between the two values. */
@kotlin.internal.InlineOnly
public inline infix fun and(other: UByte): UByte = UByte(this.data and other.data)
@@ -237,6 +237,16 @@ public value class UInt @kotlin.internal.IntrinsicConstEvaluation @PublishedApi
@kotlin.internal.InlineOnly
public inline operator fun rangeTo(other: UInt): UIntRange = UIntRange(this, other)
/**
* Creates a range from this value up to but excluding the specified [other] value.
*
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
public inline operator fun rangeUntil(other: UInt): UIntRange = this until other
/**
* Shifts this value left by the [bitCount] number of bits.
*
@@ -237,6 +237,16 @@ public value class ULong @kotlin.internal.IntrinsicConstEvaluation @PublishedApi
@kotlin.internal.InlineOnly
public inline operator fun rangeTo(other: ULong): ULongRange = ULongRange(this, other)
/**
* Creates a range from this value up to but excluding the specified [other] value.
*
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
public inline operator fun rangeUntil(other: ULong): ULongRange = this until other
/**
* Shifts this value left by the [bitCount] number of bits.
*
@@ -237,6 +237,16 @@ public value class UShort @kotlin.internal.IntrinsicConstEvaluation @PublishedAp
@kotlin.internal.InlineOnly
public inline operator fun rangeTo(other: UShort): UIntRange = UIntRange(this.toUInt(), other.toUInt())
/**
* Creates a range from this value up to but excluding the specified [other] value.
*
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@kotlin.internal.InlineOnly
public inline operator fun rangeUntil(other: UShort): UIntRange = this.toUInt() until other.toUInt()
/** Performs a bitwise AND operation between the two values. */
@kotlin.internal.InlineOnly
public inline infix fun and(other: UShort): UShort = UShort(this.data and other.data)