gitlab.com/evatix-go/core@v1.3.55/coremath/integerOutOfRange.go (about) 1 package coremath 2 3 import ( 4 "math" 5 6 "gitlab.com/evatix-go/core/constants" 7 "gitlab.com/evatix-go/core/osconsts" 8 ) 9 10 type integerOutOfRange struct{} 11 12 func (it integerOutOfRange) ToByte(value int) bool { 13 return !(value >= 0 && value <= 255) 14 } 15 16 func (it integerOutOfRange) ToUnsignedInt16(value int) bool { 17 return !(value >= 0 && value <= math.MaxUint16) 18 } 19 20 func (it integerOutOfRange) ToUnsignedInt32(value int) bool { 21 if osconsts.IsX32Architecture { 22 return !(value >= 0 && value <= math.MaxInt32) 23 } 24 25 return !(value >= 0 && value <= math.MaxInt32) 26 } 27 28 func (it integerOutOfRange) ToUnsignedInt64(value int) bool { 29 return !(value >= 0) 30 } 31 32 func (it integerOutOfRange) ToInt8(value int) bool { 33 return !(value >= math.MinInt8 && value <= math.MaxInt8) 34 } 35 36 func (it integerOutOfRange) ToInt16(value int) bool { 37 return !(value >= math.MinInt16 && value <= math.MaxInt16) 38 } 39 40 func (it integerOutOfRange) ToInt32(value int) bool { 41 return !(value >= math.MinInt32 && value <= math.MaxInt32) 42 } 43 44 func (it integerOutOfRange) ToInt(value int) bool { 45 return !(value >= constants.MinInt && value <= constants.MaxInt) 46 }