Skip to content

Commit fe9aad9

Browse files
Abduqodiri Qurbonzodaminamoto79
Abduqodiri Qurbonzoda
authored andcommitted
Promote bit query api to stable
(cherry picked from commit 9ed97747f2209c3a90de319df8fcfe20fb695acd)
1 parent ebc2dc6 commit fe9aad9

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

runtime/src/main/kotlin/kotlin/Numbers.kt

+20-20
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ internal external fun fromBits(bits: Int): Float
107107
/**
108108
* Counts the number of set bits in the binary representation of this [Int] number.
109109
*/
110-
@SinceKotlin("1.3")
111-
@ExperimentalStdlibApi
110+
@SinceKotlin("1.4")
111+
@WasExperimental(ExperimentalStdlibApi::class)
112112
@SymbolName("Kotlin_Int_countOneBits")
113113
public actual external fun Int.countOneBits(): Int
114114

@@ -122,8 +122,8 @@ private external fun countLeadingZeroBits(value: Int): Int
122122
/**
123123
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
124124
*/
125-
@SinceKotlin("1.3")
126-
@ExperimentalStdlibApi
125+
@SinceKotlin("1.4")
126+
@WasExperimental(ExperimentalStdlibApi::class)
127127
public actual fun Int.countLeadingZeroBits(): Int =
128128
if (this == 0) 32 else countLeadingZeroBits(this)
129129

@@ -137,26 +137,26 @@ private external fun countTrailingZeroBits(value: Int): Int
137137
/**
138138
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
139139
*/
140-
@SinceKotlin("1.3")
141-
@ExperimentalStdlibApi
140+
@SinceKotlin("1.4")
141+
@WasExperimental(ExperimentalStdlibApi::class)
142142
public actual fun Int.countTrailingZeroBits(): Int =
143143
if (this == 0) 32 else countTrailingZeroBits(this)
144144

145145
/**
146146
* Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,
147147
* or zero, if this number is zero.
148148
*/
149-
@SinceKotlin("1.3")
150-
@ExperimentalStdlibApi
149+
@SinceKotlin("1.4")
150+
@WasExperimental(ExperimentalStdlibApi::class)
151151
public actual fun Int.takeHighestOneBit(): Int =
152152
if (this == 0) 0 else 1.shl(32 - 1 - countLeadingZeroBits(this))
153153

154154
/**
155155
* Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,
156156
* or zero, if this number is zero.
157157
*/
158-
@SinceKotlin("1.3")
159-
@ExperimentalStdlibApi
158+
@SinceKotlin("1.4")
159+
@WasExperimental(ExperimentalStdlibApi::class)
160160
public actual fun Int.takeLowestOneBit(): Int =
161161
this and -this
162162

@@ -195,8 +195,8 @@ public actual fun Int.rotateRight(bitCount: Int): Int =
195195
/**
196196
* Counts the number of set bits in the binary representation of this [Long] number.
197197
*/
198-
@SinceKotlin("1.3")
199-
@ExperimentalStdlibApi
198+
@SinceKotlin("1.4")
199+
@WasExperimental(ExperimentalStdlibApi::class)
200200
@SymbolName("Kotlin_Long_countOneBits")
201201
public actual external fun Long.countOneBits(): Int
202202

@@ -210,8 +210,8 @@ private external fun countLeadingZeroBits(value: Long): Int
210210
/**
211211
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
212212
*/
213-
@SinceKotlin("1.3")
214-
@ExperimentalStdlibApi
213+
@SinceKotlin("1.4")
214+
@WasExperimental(ExperimentalStdlibApi::class)
215215
public actual fun Long.countLeadingZeroBits(): Int =
216216
if (this == 0L) 64 else countLeadingZeroBits(this)
217217

@@ -225,26 +225,26 @@ private external fun countTrailingZeroBits(value: Long): Int
225225
/**
226226
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
227227
*/
228-
@SinceKotlin("1.3")
229-
@ExperimentalStdlibApi
228+
@SinceKotlin("1.4")
229+
@WasExperimental(ExperimentalStdlibApi::class)
230230
public actual fun Long.countTrailingZeroBits(): Int =
231231
if (this == 0L) 64 else countTrailingZeroBits(this)
232232

233233
/**
234234
* Returns a number having a single bit set in the position of the most significant set bit of this [Long] number,
235235
* or zero, if this number is zero.
236236
*/
237-
@SinceKotlin("1.3")
238-
@ExperimentalStdlibApi
237+
@SinceKotlin("1.4")
238+
@WasExperimental(ExperimentalStdlibApi::class)
239239
public actual fun Long.takeHighestOneBit(): Long =
240240
if (this == 0L) 0L else 1L.shl(64 - 1 - countLeadingZeroBits(this))
241241

242242
/**
243243
* Returns a number having a single bit set in the position of the least significant set bit of this [Long] number,
244244
* or zero, if this number is zero.
245245
*/
246-
@SinceKotlin("1.3")
247-
@ExperimentalStdlibApi
246+
@SinceKotlin("1.4")
247+
@WasExperimental(ExperimentalStdlibApi::class)
248248
public actual fun Long.takeLowestOneBit(): Long =
249249
this and -this
250250

0 commit comments

Comments
 (0)