Skip to content

Instantly share code, notes, and snippets.

@sshaplygin
Last active April 16, 2020 23:08
Show Gist options
  • Save sshaplygin/522966095363c21b7c50d0aae86a1ec5 to your computer and use it in GitHub Desktop.
Save sshaplygin/522966095363c21b7c50d0aae86a1ec5 to your computer and use it in GitHub Desktop.
Golang max and min math constants with bytes shifts from SOF https://stackoverflow.com/questions/6878590/the-maximum-value-for-an-int-type-in-go
const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment