diff --git a/src/math/const.go b/src/math/const.go index 31954b0caea..5ea935fb425 100644 --- a/src/math/const.go +++ b/src/math/const.go @@ -37,6 +37,10 @@ const ( // Integer limit values. const ( + intSize = 32 << (^uint(0) >> 63) // 32 or 64 + + MaxInt = 1<<(intSize-1) - 1 + MinInt = -1 << (intSize - 1) MaxInt8 = 1<<7 - 1 MinInt8 = -1 << 7 MaxInt16 = 1<<15 - 1 @@ -45,6 +49,7 @@ const ( MinInt32 = -1 << 31 MaxInt64 = 1<<63 - 1 MinInt64 = -1 << 63 + MaxUint = 1<