Summary Files Commits Branches @commit @diff @stats
path: root / go-src / utils
diff options
context:
space:
mode:
1 files changed, 12 insertions, 0 deletions
-rw-r--r--go-src/utils/utils.go12
diff --git a/go-src/utils/utils.go b/go-src/utils/utils.go
index d241da6..a6aa08f 100644
--- a/go-src/utils/utils.go
+++ b/go-src/utils/utils.go
@@ -1,6 +1,7 @@
package utils
import (
+ "math"
"os"
)
@@ -38,6 +39,17 @@ func StrShortenRight(s *string, amount int) {
*s = (*s)[:len(*s)-amount]
}
+func MaxInt(x int, y int) int {
+ if x > y {
+ return x
+ }
+ return y
+}
+
+func CeilDivInt(x int, y int) int {
+ return int(math.Ceil(float64(x) / float64(y)))
+}
+
// Special thanks to icza, over on https://stackoverflow.com/a/59375088 for the If constuction
type If bool