diff options
Diffstat (limited to 'go-src/utils')
| -rw-r--r-- | go-src/utils/utils.go | 12 |
1 files changed, 12 insertions, 0 deletions
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 |
