Promote rotateLeft and rotateRight to stable

This commit is contained in:
Abduqodiri Qurbonzoda
2021-09-13 16:07:55 +03:00
parent 34a50e4e34
commit d9f8ce899a
8 changed files with 128 additions and 152 deletions
+8 -8
View File
@@ -100,8 +100,8 @@ public actual fun Int.takeLowestOneBit(): Int =
* Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally
* `number.rotateLeft(n) == number.rotateLeft(n % 32)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@SinceKotlin("1.6")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Int.rotateLeft(bitCount: Int): Int =
shl(bitCount) or ushr(Int.SIZE_BITS - bitCount)
@@ -116,8 +116,8 @@ public actual fun Int.rotateLeft(bitCount: Int): Int =
* Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally
* `number.rotateRight(n) == number.rotateRight(n % 32)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@SinceKotlin("1.6")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Int.rotateRight(bitCount: Int): Int =
shl(Int.SIZE_BITS - bitCount) or ushr(bitCount)
@@ -186,8 +186,8 @@ public actual fun Long.takeLowestOneBit(): Long =
* Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally
* `number.rotateLeft(n) == number.rotateLeft(n % 64)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@SinceKotlin("1.6")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Long.rotateLeft(bitCount: Int): Long {
if ((bitCount and 31) != 0) {
val low = this.low
@@ -211,7 +211,7 @@ public actual fun Long.rotateLeft(bitCount: Int): Long {
* Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally
* `number.rotateRight(n) == number.rotateRight(n % 64)`
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@SinceKotlin("1.6")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public actual inline fun Long.rotateRight(bitCount: Int): Long = rotateLeft(-bitCount)