MCPcopy Create free account
hub / github.com/dolthub/doltgresql / decodeNonsortingDecimalValue

Function decodeNonsortingDecimalValue

postgres/parser/encoding/decimal.go:693–711  ·  view source on GitHub ↗
(dec *apd.Decimal, negExp bool, buf, tmp []byte)

Source from the content-addressed store, hash-verified

691}
692
693func decodeNonsortingDecimalValue(dec *apd.Decimal, negExp bool, buf, tmp []byte) error {
694 // Decode the exponent.
695 buf, e, err := DecodeUvarintAscending(buf)
696 if err != nil {
697 return err
698 }
699 if negExp {
700 e = -e
701 }
702
703 bi := &dec.Coeff
704 bi.SetBytes(buf)
705
706 // Set the decimal's scale.
707 nDigits := int(apd.NumDigits(bi))
708 exp := int(e) - nDigits
709 dec.Exponent = int32(exp)
710 return nil
711}
712
713func decodeNonsortingDecimalValueWithoutExp(dec *apd.Decimal, buf, tmp []byte) {
714 bi := &dec.Coeff

Callers 1

Calls 1

DecodeUvarintAscendingFunction · 0.85

Tested by

no test coverage detected