Introduce SIZE_BYTES and SIZE_BITS constants for all integral types
#KT-8247 Fixed
This commit is contained in:
@@ -89,6 +89,18 @@ public class Char private constructor() : Comparable<Char> {
|
||||
* The maximum value of a Unicode surrogate code unit.
|
||||
*/
|
||||
public const val MAX_SURROGATE: Char = MAX_LOW_SURROGATE
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent a Char in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 2
|
||||
|
||||
/**
|
||||
* The number of bits used to represent a Char in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 16
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,18 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
* A constant holding the maximum value an instance of Byte can have.
|
||||
*/
|
||||
public const val MAX_VALUE: Byte = 127
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent an instance of Byte in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 1
|
||||
|
||||
/**
|
||||
* The number of bits used to represent an instance of Byte in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 8
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,6 +210,18 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
* A constant holding the maximum value an instance of Short can have.
|
||||
*/
|
||||
public const val MAX_VALUE: Short = 32767
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent an instance of Short in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 2
|
||||
|
||||
/**
|
||||
* The number of bits used to represent an instance of Short in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 16
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,6 +398,18 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
* A constant holding the maximum value an instance of Int can have.
|
||||
*/
|
||||
public const val MAX_VALUE: Int = 2147483647
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent an instance of Int in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 4
|
||||
|
||||
/**
|
||||
* The number of bits used to represent an instance of Int in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 32
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,6 +601,18 @@ public class Long private constructor() : Number(), Comparable<Long> {
|
||||
* A constant holding the maximum value an instance of Long can have.
|
||||
*/
|
||||
public const val MAX_VALUE: Long = 9223372036854775807L
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent an instance of Long in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 8
|
||||
|
||||
/**
|
||||
* The number of bits used to represent an instance of Long in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 64
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user