Skip to content

Commit 4e00551

Browse files
authored
[libc] Allow BigInt class to use base word types other than uint64_t. (#81634)
This will allow DyadicFloat class to replace NormalFloat class.
1 parent d0a1bf8 commit 4e00551

File tree

5 files changed

+493
-390
lines changed

5 files changed

+493
-390
lines changed

libc/src/__support/FPUtil/dyadic_float.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ constexpr DyadicFloat<Bits> quick_add(DyadicFloat<Bits> a,
216216
if (result.mantissa.add(b.mantissa)) {
217217
// Mantissa addition overflow.
218218
result.shift_right(1);
219-
result.mantissa.val[DyadicFloat<Bits>::MantissaType::WORDCOUNT - 1] |=
219+
result.mantissa.val[DyadicFloat<Bits>::MantissaType::WORD_COUNT - 1] |=
220220
(uint64_t(1) << 63);
221221
}
222222
// Result is already normalized.
@@ -243,7 +243,7 @@ constexpr DyadicFloat<Bits> quick_add(DyadicFloat<Bits> a,
243243
// result.mantissa = quick_mul_hi(a.mantissa + b.mantissa)
244244
// ~ (full product a.mantissa * b.mantissa) >> Bits.
245245
// The errors compared to the mathematical product is bounded by:
246-
// 2 * errors of quick_mul_hi = 2 * (UInt<Bits>::WORDCOUNT - 1) in ULPs.
246+
// 2 * errors of quick_mul_hi = 2 * (UInt<Bits>::WORD_COUNT - 1) in ULPs.
247247
// Assume inputs are normalized (by constructors or other functions) so that we
248248
// don't need to normalize the inputs again in this function. If the inputs are
249249
// not normalized, the results might lose precision significantly.
@@ -258,7 +258,7 @@ constexpr DyadicFloat<Bits> quick_mul(DyadicFloat<Bits> a,
258258
result.mantissa = a.mantissa.quick_mul_hi(b.mantissa);
259259
// Check the leading bit directly, should be faster than using clz in
260260
// normalize().
261-
if (result.mantissa.val[DyadicFloat<Bits>::MantissaType::WORDCOUNT - 1] >>
261+
if (result.mantissa.val[DyadicFloat<Bits>::MantissaType::WORD_COUNT - 1] >>
262262
63 ==
263263
0)
264264
result.shift_left(1);

0 commit comments

Comments
 (0)