diff options
| Commit | 6b91e76cfdd409e494fc2555af48037bbe286800 (patch) | |
|---|---|---|
| Author | 2021-07-22 15:44:17 +0300 | |
| Committer | 2021-07-22 15:44:17 +0300 | |
| Files | 2a0975d12900b78a8b4b550f43c73261b2a000ba /go-src/utils | |
| ctfc-6b91e76cfdd409e494fc2555af48037bbe286800.tar ctfc-6b91e76cfdd409e494fc2555af48037bbe286800.tar.gz ctfc-6b91e76cfdd409e494fc2555af48037bbe286800.zip | ||
| Parent | 8c758581a466f640201d044bf18a95882e1c86c3 (diff) | |
Moved ctfcMath functionality to utils
1 files changed, 12 insertions, 0 deletions
| -rw-r--r-- | go-src/utils/utils.go | 12 |
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 |
