From 6b91e76cfdd409e494fc2555af48037bbe286800 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 22 Jul 2021 15:44:17 +0300 Subject: Moved ctfcMath functionality to utils --- go-src/utils/utils.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'go-src/utils') 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 -- cgit v1.2.3