aboutsummaryrefslogtreecommitdiff
path: root/go-src/utils
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-07-22 15:44:17 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-07-22 15:44:17 +0300
commit6b91e76cfdd409e494fc2555af48037bbe286800 (patch)
tree2a0975d12900b78a8b4b550f43c73261b2a000ba /go-src/utils
parent8c758581a466f640201d044bf18a95882e1c86c3 (diff)
downloadctfc-6b91e76cfdd409e494fc2555af48037bbe286800.tar
ctfc-6b91e76cfdd409e494fc2555af48037bbe286800.tar.gz
ctfc-6b91e76cfdd409e494fc2555af48037bbe286800.zip
Moved ctfcMath functionality to utils
Diffstat (limited to 'go-src/utils')
-rw-r--r--go-src/utils/utils.go12
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