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