All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.valaphee.foundry.retry.Math.kt Maven / Gradle / Ivy

/*
 * Copyright (c) 2021, Valaphee.
 * All rights reserved.
 */

package com.valaphee.foundry.retry

infix fun Long.smul(other: Long) = if (this == 0L || other <= Long.MAX_VALUE / this) this * other else Long.MAX_VALUE

infix fun Long.sadd(other: Long) = if (this == 0L || other <= Long.MAX_VALUE - this) this + other else Long.MAX_VALUE

fun Int.exp2() = if (this < Long.SIZE_BITS - 1) 1L shl this else Long.MAX_VALUE




© 2015 - 2024 Weber Informatics LLC | Privacy Policy