gitlab.com/evatix-go/core@v1.3.55/coremath/integer32Within.go (about) 1 package coremath 2 3 import ( 4 "math" 5 ) 6 7 type integer32Within struct{} 8 9 func (it integer32Within) ToByte(value int32) bool { 10 return value >= 0 && value <= 255 11 } 12 13 func (it integer32Within) ToUnsignedInt16(value int32) bool { 14 return value >= 0 && value <= math.MaxUint16 15 } 16 17 func (it integer32Within) ToUnsignedInt32(value int32) bool { 18 return value >= 0 19 } 20 21 func (it integer32Within) ToUnsignedInt64(value int32) bool { 22 return value >= 0 23 } 24 25 func (it integer32Within) ToInt8(value int32) bool { 26 return value >= math.MinInt8 && value <= math.MaxInt8 27 } 28 29 func (it integer32Within) ToInt16(value int32) bool { 30 return value >= math.MinInt16 && value <= math.MaxInt16 31 } 32 33 func (it integer32Within) ToInt(value int) bool { 34 // it would be different based on architecture. 35 return value >= math.MinInt32 && value <= math.MaxInt32 36 }