|
|
|
@@ -14,6 +14,7 @@ import kotlin.math.sign
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.floorDiv(other: Byte): Int =
|
|
|
|
|
this.toInt().floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -24,12 +25,14 @@ public inline fun Byte.floorDiv(other: Byte): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.mod(other: Byte): Byte =
|
|
|
|
|
this.toInt().mod(other.toInt()).toByte()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.floorDiv(other: Short): Int =
|
|
|
|
|
this.toInt().floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -40,12 +43,14 @@ public inline fun Byte.floorDiv(other: Short): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.mod(other: Short): Short =
|
|
|
|
|
this.toInt().mod(other.toInt()).toShort()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.floorDiv(other: Int): Int =
|
|
|
|
|
this.toInt().floorDiv(other)
|
|
|
|
|
|
|
|
|
@@ -56,12 +61,14 @@ public inline fun Byte.floorDiv(other: Int): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.mod(other: Int): Int =
|
|
|
|
|
this.toInt().mod(other)
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.floorDiv(other: Long): Long =
|
|
|
|
|
this.toLong().floorDiv(other)
|
|
|
|
|
|
|
|
|
@@ -72,12 +79,14 @@ public inline fun Byte.floorDiv(other: Long): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Byte.mod(other: Long): Long =
|
|
|
|
|
this.toLong().mod(other)
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.floorDiv(other: Byte): Int =
|
|
|
|
|
this.toInt().floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -88,12 +97,14 @@ public inline fun Short.floorDiv(other: Byte): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.mod(other: Byte): Byte =
|
|
|
|
|
this.toInt().mod(other.toInt()).toByte()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.floorDiv(other: Short): Int =
|
|
|
|
|
this.toInt().floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -104,12 +115,14 @@ public inline fun Short.floorDiv(other: Short): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.mod(other: Short): Short =
|
|
|
|
|
this.toInt().mod(other.toInt()).toShort()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.floorDiv(other: Int): Int =
|
|
|
|
|
this.toInt().floorDiv(other)
|
|
|
|
|
|
|
|
|
@@ -120,12 +133,14 @@ public inline fun Short.floorDiv(other: Int): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.mod(other: Int): Int =
|
|
|
|
|
this.toInt().mod(other)
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.floorDiv(other: Long): Long =
|
|
|
|
|
this.toLong().floorDiv(other)
|
|
|
|
|
|
|
|
|
@@ -136,12 +151,14 @@ public inline fun Short.floorDiv(other: Long): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Short.mod(other: Long): Long =
|
|
|
|
|
this.toLong().mod(other)
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.floorDiv(other: Byte): Int =
|
|
|
|
|
this.floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -152,12 +169,14 @@ public inline fun Int.floorDiv(other: Byte): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.mod(other: Byte): Byte =
|
|
|
|
|
this.mod(other.toInt()).toByte()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.floorDiv(other: Short): Int =
|
|
|
|
|
this.floorDiv(other.toInt())
|
|
|
|
|
|
|
|
|
@@ -168,12 +187,14 @@ public inline fun Int.floorDiv(other: Short): Int =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.mod(other: Short): Short =
|
|
|
|
|
this.mod(other.toInt()).toShort()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.floorDiv(other: Int): Int {
|
|
|
|
|
var q = this / other
|
|
|
|
|
if (this xor other < 0 && q * other != this) q--
|
|
|
|
@@ -187,6 +208,7 @@ public inline fun Int.floorDiv(other: Int): Int {
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.mod(other: Int): Int {
|
|
|
|
|
val r = this % other
|
|
|
|
|
return r + (other and (((r xor other) and (r or -r)) shr 31))
|
|
|
|
@@ -195,6 +217,7 @@ public inline fun Int.mod(other: Int): Int {
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.floorDiv(other: Long): Long =
|
|
|
|
|
this.toLong().floorDiv(other)
|
|
|
|
|
|
|
|
|
@@ -205,12 +228,14 @@ public inline fun Int.floorDiv(other: Long): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Int.mod(other: Long): Long =
|
|
|
|
|
this.toLong().mod(other)
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.floorDiv(other: Byte): Long =
|
|
|
|
|
this.floorDiv(other.toLong())
|
|
|
|
|
|
|
|
|
@@ -221,12 +246,14 @@ public inline fun Long.floorDiv(other: Byte): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.mod(other: Byte): Byte =
|
|
|
|
|
this.mod(other.toLong()).toByte()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.floorDiv(other: Short): Long =
|
|
|
|
|
this.floorDiv(other.toLong())
|
|
|
|
|
|
|
|
|
@@ -237,12 +264,14 @@ public inline fun Long.floorDiv(other: Short): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.mod(other: Short): Short =
|
|
|
|
|
this.mod(other.toLong()).toShort()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.floorDiv(other: Int): Long =
|
|
|
|
|
this.floorDiv(other.toLong())
|
|
|
|
|
|
|
|
|
@@ -253,12 +282,14 @@ public inline fun Long.floorDiv(other: Int): Long =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.mod(other: Int): Int =
|
|
|
|
|
this.mod(other.toLong()).toInt()
|
|
|
|
|
|
|
|
|
|
/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.floorDiv(other: Long): Long {
|
|
|
|
|
var q = this / other
|
|
|
|
|
if (this xor other < 0 && q * other != this) q--
|
|
|
|
@@ -272,6 +303,7 @@ public inline fun Long.floorDiv(other: Long): Long {
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Long.mod(other: Long): Long {
|
|
|
|
|
val r = this % other
|
|
|
|
|
return r + (other and (((r xor other) and (r or -r)) shr 63))
|
|
|
|
@@ -286,6 +318,7 @@ public inline fun Long.mod(other: Long): Long {
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Float.mod(other: Float): Float {
|
|
|
|
|
val r = this % other
|
|
|
|
|
return if (r != 0.0.toFloat() && r.sign != other.sign) r + other else r
|
|
|
|
@@ -300,6 +333,7 @@ public inline fun Float.mod(other: Float): Float {
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Float.mod(other: Double): Double =
|
|
|
|
|
this.toDouble().mod(other)
|
|
|
|
|
|
|
|
|
@@ -312,6 +346,7 @@ public inline fun Float.mod(other: Double): Double =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Double.mod(other: Float): Double =
|
|
|
|
|
this.mod(other.toDouble())
|
|
|
|
|
|
|
|
|
@@ -324,6 +359,7 @@ public inline fun Double.mod(other: Float): Double =
|
|
|
|
|
*/
|
|
|
|
|
@SinceKotlin("1.5")
|
|
|
|
|
@kotlin.internal.InlineOnly
|
|
|
|
|
@kotlin.internal.IntrinsicConstEvaluation
|
|
|
|
|
public inline fun Double.mod(other: Double): Double {
|
|
|
|
|
val r = this % other
|
|
|
|
|
return if (r != 0.0 && r.sign != other.sign) r + other else r
|
|
|
|
|