MCPcopy Create free account
hub / github.com/apache/fory / canUseSmallDecimalEncoding

Function canUseSmallDecimalEncoding

go/fory/decimal.go:166–174  ·  view source on GitHub ↗
(value *big.Int)

Source from the content-addressed store, hash-verified

164}
165
166func canUseSmallDecimalEncoding(value *big.Int) bool {
167 if value == nil {
168 return true
169 }
170 if value.Cmp(decimalLongMin) < 0 || value.Cmp(decimalLongMax) > 0 {
171 return false
172 }
173 return (encodeDecimalZigZag64(value.Int64()) & (1 << 63)) == 0
174}
175
176func encodeDecimalZigZag64(value int64) uint64 {
177 return uint64((value << 1) ^ (value >> 63))

Callers 1

writeDecimalPartsFunction · 0.85

Calls 2

encodeDecimalZigZag64Function · 0.85
Int64Method · 0.80

Tested by

no test coverage detected