Promote bit query api to stable
This commit is contained in:
@@ -41,8 +41,8 @@ public actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Int.countOneBits(): Int {
|
||||
// Hacker's Delight 5-1 algorithm
|
||||
var v = this
|
||||
@@ -57,8 +57,8 @@ public actual fun Int.countOneBits(): Int {
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@Suppress("DEPRECATION")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.countLeadingZeroBits(): Int = kotlin.js.Math.clz32(this)
|
||||
@@ -66,8 +66,8 @@ public actual inline fun Int.countLeadingZeroBits(): Int = kotlin.js.Math.clz32(
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Int.countTrailingZeroBits(): Int =
|
||||
// Hacker's Delight 5-4 algorithm for expressing countTrailingZeroBits with countLeadingZeroBits
|
||||
Int.SIZE_BITS - (this or -this).inv().countLeadingZeroBits()
|
||||
@@ -76,8 +76,8 @@ public actual fun Int.countTrailingZeroBits(): Int =
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Int.takeHighestOneBit(): Int =
|
||||
if (this == 0) 0 else 1.shl(Int.SIZE_BITS - 1 - countLeadingZeroBits())
|
||||
|
||||
@@ -85,8 +85,8 @@ public actual fun Int.takeHighestOneBit(): Int =
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Int.takeLowestOneBit(): Int =
|
||||
// Hacker's Delight 2-1 algorithm for isolating rightmost 1-bit
|
||||
this and -this
|
||||
@@ -126,16 +126,16 @@ public actual fun Int.rotateRight(bitCount: Int): Int =
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Long.countOneBits(): Int =
|
||||
high.countOneBits() + low.countOneBits()
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Long.countLeadingZeroBits(): Int =
|
||||
when (val high = this.high) {
|
||||
0 -> Int.SIZE_BITS + low.countLeadingZeroBits()
|
||||
@@ -145,8 +145,8 @@ public actual fun Long.countLeadingZeroBits(): Int =
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Long.countTrailingZeroBits(): Int =
|
||||
when (val low = this.low) {
|
||||
0 -> Int.SIZE_BITS + high.countTrailingZeroBits()
|
||||
@@ -157,8 +157,8 @@ public actual fun Long.countTrailingZeroBits(): Int =
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Long.takeHighestOneBit(): Long =
|
||||
when (val high = this.high) {
|
||||
0 -> Long(low.takeHighestOneBit(), 0)
|
||||
@@ -169,8 +169,8 @@ public actual fun Long.takeHighestOneBit(): 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Long.takeLowestOneBit(): Long =
|
||||
when (val low = this.low) {
|
||||
0 -> Long(0, high.takeLowestOneBit())
|
||||
|
||||
@@ -97,24 +97,24 @@ public actual inline fun Float.Companion.fromBits(bits: Int): Float = java.lang.
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.countOneBits(): Int = Integer.bitCount(this)
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.countLeadingZeroBits(): Int = Integer.numberOfLeadingZeros(this)
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.countTrailingZeroBits(): Int = Integer.numberOfTrailingZeros(this)
|
||||
|
||||
@@ -122,8 +122,8 @@ public actual inline fun Int.countTrailingZeroBits(): Int = Integer.numberOfTrai
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.takeHighestOneBit(): Int = Integer.highestOneBit(this)
|
||||
|
||||
@@ -131,8 +131,8 @@ public actual inline fun Int.takeHighestOneBit(): Int = Integer.highestOneBit(th
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Int.takeLowestOneBit(): Int = Integer.lowestOneBit(this)
|
||||
|
||||
@@ -171,24 +171,24 @@ public actual inline fun Int.rotateRight(bitCount: Int): Int = Integer.rotateRig
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Long.countOneBits(): Int = java.lang.Long.bitCount(this)
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Long.countLeadingZeroBits(): Int = java.lang.Long.numberOfLeadingZeros(this)
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Long.countTrailingZeroBits(): Int = java.lang.Long.numberOfTrailingZeros(this)
|
||||
|
||||
@@ -196,8 +196,8 @@ public actual inline fun Long.countTrailingZeroBits(): Int = java.lang.Long.numb
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Long.takeHighestOneBit(): Long = java.lang.Long.highestOneBit(this)
|
||||
|
||||
@@ -205,8 +205,8 @@ public actual inline fun Long.takeHighestOneBit(): Long = java.lang.Long.highest
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Long.takeLowestOneBit(): Long = java.lang.Long.lowestOneBit(this)
|
||||
|
||||
|
||||
@@ -10,38 +10,38 @@ package kotlin
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Int.countOneBits(): Int
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Int.countLeadingZeroBits(): Int
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Int.countTrailingZeroBits(): Int
|
||||
|
||||
/**
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Int.takeHighestOneBit(): Int
|
||||
|
||||
/**
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Int.takeLowestOneBit(): Int
|
||||
|
||||
/**
|
||||
@@ -77,38 +77,38 @@ public expect fun Int.rotateRight(bitCount: Int): Int
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Long.countOneBits(): Int
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Long.countLeadingZeroBits(): Int
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Long.countTrailingZeroBits(): Int
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Long.takeHighestOneBit(): 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun Long.takeLowestOneBit(): Long
|
||||
|
||||
/**
|
||||
@@ -142,24 +142,24 @@ public expect fun Long.rotateRight(bitCount: Int): Long
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Byte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Byte.countOneBits(): Int = (toInt() and 0xFF).countOneBits()
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Byte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Byte.countLeadingZeroBits(): Int = (toInt() and 0xFF).countLeadingZeroBits() - (Int.SIZE_BITS - Byte.SIZE_BITS)
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Byte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Byte.countTrailingZeroBits(): Int = (toInt() or 0x100).countTrailingZeroBits()
|
||||
|
||||
@@ -167,8 +167,8 @@ public inline fun Byte.countTrailingZeroBits(): Int = (toInt() or 0x100).countTr
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [Byte] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Byte.takeHighestOneBit(): Byte = (toInt() and 0xFF).takeHighestOneBit().toByte()
|
||||
|
||||
@@ -176,8 +176,8 @@ public inline fun Byte.takeHighestOneBit(): Byte = (toInt() and 0xFF).takeHighes
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [Byte] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Byte.takeLowestOneBit(): Byte = toInt().takeLowestOneBit().toByte()
|
||||
|
||||
@@ -215,16 +215,16 @@ public fun Byte.rotateRight(bitCount: Int): Byte =
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [Short] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Short.countOneBits(): Int = (toInt() and 0xFFFF).countOneBits()
|
||||
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Short] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Short.countLeadingZeroBits(): Int =
|
||||
(toInt() and 0xFFFF).countLeadingZeroBits() - (Int.SIZE_BITS - Short.SIZE_BITS)
|
||||
@@ -232,8 +232,8 @@ public inline fun Short.countLeadingZeroBits(): Int =
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Short] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Short.countTrailingZeroBits(): Int = (toInt() or 0x10000).countTrailingZeroBits()
|
||||
|
||||
@@ -241,8 +241,8 @@ public inline fun Short.countTrailingZeroBits(): Int = (toInt() or 0x10000).coun
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [Short] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Short.takeHighestOneBit(): Short = (toInt() and 0xFFFF).takeHighestOneBit().toShort()
|
||||
|
||||
@@ -250,8 +250,8 @@ public inline fun Short.takeHighestOneBit(): Short = (toInt() and 0xFFFF).takeHi
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [Short] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Short.takeLowestOneBit(): Short = toInt().takeLowestOneBit().toShort()
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ package kotlin
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [UInt] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UInt.countOneBits(): Int = toInt().countOneBits()
|
||||
@@ -18,8 +18,8 @@ public inline fun UInt.countOneBits(): Int = toInt().countOneBits()
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [UInt] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UInt.countLeadingZeroBits(): Int = toInt().countLeadingZeroBits()
|
||||
@@ -27,8 +27,8 @@ public inline fun UInt.countLeadingZeroBits(): Int = toInt().countLeadingZeroBit
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [UInt] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UInt.countTrailingZeroBits(): Int = toInt().countTrailingZeroBits()
|
||||
@@ -37,8 +37,8 @@ public inline fun UInt.countTrailingZeroBits(): Int = toInt().countTrailingZeroB
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [UInt] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UInt.takeHighestOneBit(): UInt = toInt().takeHighestOneBit().toUInt()
|
||||
@@ -47,8 +47,8 @@ public inline fun UInt.takeHighestOneBit(): UInt = toInt().takeHighestOneBit().t
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [UInt] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UInt.takeLowestOneBit(): UInt = toInt().takeLowestOneBit().toUInt()
|
||||
@@ -90,8 +90,8 @@ public inline fun UInt.rotateRight(bitCount: Int): UInt = toInt().rotateRight(bi
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [ULong] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULong.countOneBits(): Int = toLong().countOneBits()
|
||||
@@ -99,8 +99,8 @@ public inline fun ULong.countOneBits(): Int = toLong().countOneBits()
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [ULong] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULong.countLeadingZeroBits(): Int = toLong().countLeadingZeroBits()
|
||||
@@ -108,8 +108,8 @@ public inline fun ULong.countLeadingZeroBits(): Int = toLong().countLeadingZeroB
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [ULong] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULong.countTrailingZeroBits(): Int = toLong().countTrailingZeroBits()
|
||||
@@ -118,8 +118,8 @@ public inline fun ULong.countTrailingZeroBits(): Int = toLong().countTrailingZer
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [ULong] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULong.takeHighestOneBit(): ULong = toLong().takeHighestOneBit().toULong()
|
||||
@@ -128,8 +128,8 @@ public inline fun ULong.takeHighestOneBit(): ULong = toLong().takeHighestOneBit(
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [ULong] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun ULong.takeLowestOneBit(): ULong = toLong().takeLowestOneBit().toULong()
|
||||
@@ -169,8 +169,8 @@ public inline fun ULong.rotateRight(bitCount: Int): ULong = toLong().rotateRight
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [UByte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByte.countOneBits(): Int = toUInt().countOneBits()
|
||||
@@ -178,8 +178,8 @@ public inline fun UByte.countOneBits(): Int = toUInt().countOneBits()
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [UByte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByte.countLeadingZeroBits(): Int = toByte().countLeadingZeroBits()
|
||||
@@ -187,8 +187,8 @@ public inline fun UByte.countLeadingZeroBits(): Int = toByte().countLeadingZeroB
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [UByte] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByte.countTrailingZeroBits(): Int = toByte().countTrailingZeroBits()
|
||||
@@ -197,8 +197,8 @@ public inline fun UByte.countTrailingZeroBits(): Int = toByte().countTrailingZer
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByte.takeHighestOneBit(): UByte = toInt().takeHighestOneBit().toUByte()
|
||||
@@ -207,8 +207,8 @@ public inline fun UByte.takeHighestOneBit(): UByte = toInt().takeHighestOneBit()
|
||||
* 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.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UByte.takeLowestOneBit(): UByte = toInt().takeLowestOneBit().toUByte()
|
||||
@@ -249,8 +249,8 @@ public inline fun UByte.rotateRight(bitCount: Int): UByte = toByte().rotateRight
|
||||
/**
|
||||
* Counts the number of set bits in the binary representation of this [UShort] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShort.countOneBits(): Int = toUInt().countOneBits()
|
||||
@@ -258,8 +258,8 @@ public inline fun UShort.countOneBits(): Int = toUInt().countOneBits()
|
||||
/**
|
||||
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [UShort] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShort.countLeadingZeroBits(): Int = toShort().countLeadingZeroBits()
|
||||
@@ -267,8 +267,8 @@ public inline fun UShort.countLeadingZeroBits(): Int = toShort().countLeadingZer
|
||||
/**
|
||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [UShort] number.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShort.countTrailingZeroBits(): Int = toShort().countTrailingZeroBits()
|
||||
@@ -277,8 +277,8 @@ public inline fun UShort.countTrailingZeroBits(): Int = toShort().countTrailingZ
|
||||
* Returns a number having a single bit set in the position of the most significant set bit of this [UShort] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShort.takeHighestOneBit(): UShort = toInt().takeHighestOneBit().toUShort()
|
||||
@@ -287,8 +287,8 @@ public inline fun UShort.takeHighestOneBit(): UShort = toInt().takeHighestOneBit
|
||||
* Returns a number having a single bit set in the position of the least significant set bit of this [UShort] number,
|
||||
* or zero, if this number is zero.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun UShort.takeLowestOneBit(): UShort = toInt().takeLowestOneBit().toUShort()
|
||||
|
||||
Reference in New Issue
Block a user