UpperBoundNonsortingDecimalSize returns the upper bound number of bytes that the decimal will need for the non-sorting encoding.
(d *apd.Decimal)
| 708 | // UpperBoundNonsortingDecimalSize returns the upper bound number of bytes |
| 709 | // that the decimal will need for the non-sorting encoding. |
| 710 | func 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 |
no test coverage detected
searching dependent graphs…