Make overridden compareTo in unsigned types inline only
This commit is contained in:
@@ -41,7 +41,9 @@ public inline class UByte @PublishedApi internal constructor(@PublishedApi inter
|
||||
* 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.
|
||||
*/
|
||||
public override operator fun compareTo(other: UByte): Int = this.toUInt().compareTo(other.toUInt())
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("OVERRIDE_BY_INLINE")
|
||||
public override inline operator fun compareTo(other: UByte): Int = this.toUInt().compareTo(other.toUInt())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
|
||||
@@ -57,7 +57,9 @@ public inline class UInt @PublishedApi internal constructor(@PublishedApi intern
|
||||
* 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.
|
||||
*/
|
||||
public override operator fun compareTo(other: UInt): Int = uintCompare(this.data, other.data)
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("OVERRIDE_BY_INLINE")
|
||||
public override inline operator fun compareTo(other: UInt): Int = uintCompare(this.data, other.data)
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
|
||||
@@ -65,7 +65,9 @@ public inline class ULong @PublishedApi internal constructor(@PublishedApi inter
|
||||
* 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.
|
||||
*/
|
||||
public override operator fun compareTo(other: ULong): Int = ulongCompare(this.data, other.data)
|
||||
@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
|
||||
|
||||
@@ -49,7 +49,9 @@ public inline class UShort @PublishedApi internal constructor(@PublishedApi inte
|
||||
* 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.
|
||||
*/
|
||||
public override operator fun compareTo(other: UShort): Int = this.toUInt().compareTo(other.toUInt())
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("OVERRIDE_BY_INLINE")
|
||||
public override inline operator fun compareTo(other: UShort): Int = this.toUInt().compareTo(other.toUInt())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
@file:UseExperimental(ExperimentalUnsignedTypes::class)
|
||||
package kotlin
|
||||
|
||||
@PublishedApi
|
||||
internal fun uintCompare(v1: Int, v2: Int): Int = (v1 xor Int.MIN_VALUE).compareTo(v2 xor Int.MIN_VALUE)
|
||||
@PublishedApi
|
||||
internal fun ulongCompare(v1: Long, v2: Long): Int = (v1 xor Long.MIN_VALUE).compareTo(v2 xor Long.MIN_VALUE)
|
||||
|
||||
@PublishedApi
|
||||
|
||||
Reference in New Issue
Block a user