MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / UpperBoundNonsortingDecimalSize

Function UpperBoundNonsortingDecimalSize

pkg/util/encoding/decimal.go:710–716  ·  view source on GitHub ↗

UpperBoundNonsortingDecimalSize returns the upper bound number of bytes that the decimal will need for the non-sorting encoding.

(d *apd.Decimal)

Source from the content-addressed store, hash-verified

708// UpperBoundNonsortingDecimalSize returns the upper bound number of bytes
709// that the decimal will need for the non-sorting encoding.
710func UpperBoundNonsortingDecimalSize(d *apd.Decimal) int {
711 // Makeup of upper bound size:
712 // - 1 byte for the prefix
713 // - maxVarintSize for the exponent
714 // - WordLen for the big.Int bytes
715 return 1 + maxVarintSize + WordLen(d.Coeff.Bits())
716}
717
718// upperBoundNonsortingDecimalUnscaledSize is the same as
719// UpperBoundNonsortingDecimalSize but for a decimal with the given unscaled

Callers 1

EncodeNonsortingDecimalFunction · 0.85

Calls 1

WordLenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…