llvm::ScaledNumbers::getSum

Get the sum of two scaled numbers.

Synopsis

Declared in <llvm/Support/ScaledNumber.h>

template<class DigitsT>
std::pair<DigitsT, int16_t>
getSum(
    DigitsT LDigits,
    int16_t LScale,
    DigitsT RDigits,
    int16_t RScale);

Description

Get the sum of two scaled numbers with as much precision as possible.

Return Value

Sum as a digits/scale pair.

Parameters

NameDescription
LDigitsDigits of the left-hand scaled number.
LScaleScale of the left-hand scaled number.
RDigitsDigits of the right-hand scaled number.
RScaleScale of the right-hand scaled number.

Preconditions

  • Adding 1 to LScale (or RScale) will not overflow INT16_MAX.