Add more details about bit shift operations #KT-41112

This commit is contained in:
Abduqodiri Qurbonzoda
2020-09-14 00:06:57 +03:00
committed by Abduqodiri Qurbonzoda
parent 1c0ac850e8
commit 36e6247125
9 changed files with 219 additions and 26 deletions
+42 -6
View File
@@ -589,12 +589,30 @@ public class Int private constructor() : Number(), Comparable<Int> {
/** Creates a range from this value to the specified [other] value. */
public operator fun rangeTo(other: Long): LongRange
/** Shifts this value left by the [bitCount] number of bits. */
/**
* Shifts this value left by the [bitCount] number of bits.
*
* Note that only the five lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..31`.
*/
public infix fun shl(bitCount: Int): Int
/** Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit. */
/**
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit.
*
* Note that only the five lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..31`.
*/
public infix fun shr(bitCount: Int): Int
/** Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros. */
/**
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.
*
* Note that only the five lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..31`.
*/
public infix fun ushr(bitCount: Int): Int
/** Performs a bitwise AND operation between the two values. */
public infix fun and(other: Int): Int
/** Performs a bitwise OR operation between the two values. */
@@ -818,12 +836,30 @@ public class Long private constructor() : Number(), Comparable<Long> {
/** Creates a range from this value to the specified [other] value. */
public operator fun rangeTo(other: Long): LongRange
/** Shifts this value left by the [bitCount] number of bits. */
/**
* Shifts this value left by the [bitCount] number of bits.
*
* Note that only the six lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..63`.
*/
public infix fun shl(bitCount: Int): Long
/** Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit. */
/**
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit.
*
* Note that only the six lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..63`.
*/
public infix fun shr(bitCount: Int): Long
/** Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros. */
/**
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.
*
* Note that only the six lowest-order bits of the [bitCount] are used as the shift distance.
* The shift distance actually used is therefore always in the range `0..63`.
*/
public infix fun ushr(bitCount: Int): Long
/** Performs a bitwise AND operation between the two values. */
public infix fun and(other: Long): Long
/** Performs a bitwise OR operation between the two values. */