summaryrefslogtreecommitdiff
path: root/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/io/dico/parcels2/util/ext/Math.kt')
-rw-r--r--src/main/kotlin/io/dico/parcels2/util/ext/Math.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt b/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt
index 62ee220..f3b6d3b 100644
--- a/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt
+++ b/src/main/kotlin/io/dico/parcels2/util/ext/Math.kt
@@ -32,4 +32,9 @@ fun IntRange.clamp(min: Int, max: Int): IntRange {
}
// the name coerceAtMost is bad
-fun Int.clampMax(max: Int) = coerceAtMost(max) \ No newline at end of file
+fun Int.clampMax(max: Int) = coerceAtMost(max)
+
+// Why does this not exist?
+infix fun Int.ceilDiv(divisor: Int): Int {
+ return -Math.floorDiv(-this, divisor)
+} \ No newline at end of file