Promote bit query api to stable

This commit is contained in:
Abduqodiri Qurbonzoda
2020-05-28 02:48:01 +03:00
parent 55eb75d237
commit f6a739bbc5
4 changed files with 120 additions and 120 deletions
+40 -40
View File
@@ -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()