[flang] clean up a todo

Original-commit: flang-compiler/f18@1107bd1f02
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-08-14 13:21:36 -07:00
parent 93f3ae8aeb
commit 9cdb101a4d
3 changed files with 6 additions and 22 deletions

View file

@ -79,15 +79,6 @@ public:
return *this;
}
BigRadixFloatingPointNumber &Clamp(int decimals) {
if (decimals >= maxDigits * log10Radix) {
digitLimit_ = maxDigits;
} else {
digitLimit_ = (decimals + log10Radix - 1) / log10Radix;
}
return *this;
}
// Reads a character representation of a floating-point value into
// this decimal floating-point representation. The reference argument
// is a pointer that is left pointing to the first character that wasn't

View file

@ -319,7 +319,6 @@ ConversionToDecimalResult ConvertToDecimal(char *buffer, size_t size, int flags,
}
number.Minimize(Big{less, rounding}, Big{more, rounding});
}
number.Clamp(digits); // todo pmk retain Clamp?
return number.ConvertToDecimal(buffer, size, flags, digits);
}
}

View file

@ -143,15 +143,9 @@ public:
++exponent_;
}
// Multiply by 2 and add an incoming carry (pmk: simplify now that it's 2)
template<int N> void MultiplyAndAdd(int carry = 0) {
static_assert(N > 1 && N < 16);
HostUnsignedIntType<precision + 4> v{value_}, g{guard_};
g *= N;
guard_ = (guard_ & 1) | (g & mask);
g >>= precision;
v *= N;
v += g + carry;
void DoubleAndAdd(int carry = 0) {
HostUnsignedIntType<precision + 1> v;
v = value_ + value_ + carry;
value_ = v & mask;
for (v >>= precision; v > 0; v >>= 1) {
ShiftDown();
@ -171,7 +165,7 @@ public:
bool isNegative, enum FortranRounding) const;
private:
IntType value_{0}, guard_{0};
IntType value_{0}, guard_{0}; // todo pmk: back to 3-bit guard
int exponent_{0};
};
@ -340,9 +334,9 @@ BigRadixFloatingPointNumber<PREC, LOG10RADIX>::ConvertToBinary() {
if (carry != 0 && exponent_ < 0) {
digit_[digits_++] = carry;
exponent_ += log10Radix;
f.template MultiplyAndAdd<2>(0);
f.DoubleAndAdd(0);
} else {
f.template MultiplyAndAdd<2>(carry);
f.DoubleAndAdd(carry);
}
}
if (!IsZero()) {