Introduce bitwise operations and/or/xor/inv for Byte and Short. #KT-13554

Annotate new bitwise operations with SinceKotlin.
This commit is contained in:
Ilya Gorbunov
2016-09-28 06:57:17 +03:00
parent 7f86ce0a20
commit 62fb47d137
11 changed files with 304 additions and 2 deletions
+26
View File
@@ -160,6 +160,19 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
/** Creates a range from this value to the specified [other] value. */
public operator fun rangeTo(other: Long): LongRange
/** Performs a bitwise AND operation between the two values. */
@SinceKotlin("1.1")
public infix fun and(other: Byte): Byte
/** Performs a bitwise OR operation between the two values. */
@SinceKotlin("1.1")
public infix fun or(other: Byte): Byte
/** Performs a bitwise XOR operation between the two values. */
@SinceKotlin("1.1")
public infix fun xor(other: Byte): Byte
/** Inverts the bits in this value/ */
@SinceKotlin("1.1")
public fun inv(): Byte
public override fun toByte(): Byte
public override fun toChar(): Char
public override fun toShort(): Short
@@ -311,6 +324,19 @@ public class Short private constructor() : Number(), Comparable<Short> {
/** Creates a range from this value to the specified [other] value. */
public operator fun rangeTo(other: Long): LongRange
/** Performs a bitwise AND operation between the two values. */
@SinceKotlin("1.1")
public infix fun and(other: Short): Short
/** Performs a bitwise OR operation between the two values. */
@SinceKotlin("1.1")
public infix fun or(other: Short): Short
/** Performs a bitwise XOR operation between the two values. */
@SinceKotlin("1.1")
public infix fun xor(other: Short): Short
/** Inverts the bits in this value/ */
@SinceKotlin("1.1")
public fun inv(): Short
public override fun toByte(): Byte
public override fun toChar(): Char
public override fun toShort(): Short