Created
October 2, 2020 02:30
-
-
Save codegold79/aeafe489853f28bb842d2aae9b001063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func incMemVal(mem float64) string { | |
| // 2^13 = 8192. 8GB is max RAM. | |
| maxExp := 13 | |
| newMem := 1 << maxExp | |
| exp := int(math.Round(math.Log10(mem) / math.Log10(2))) | |
| exp++ | |
| if exp < maxExp { | |
| newMem = 1 << exp | |
| } | |
| return strconv.Itoa(newMem) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment