2020#include " src/__support/libc_assert.h"
2121#include " src/__support/macros/attributes.h"
2222#include " src/__support/macros/config.h"
23+ #include " src/__support/sign.h"
2324
2425// This file has 5 compile-time flags to allow the user to configure the float
2526// to string behavior. These were used to explore tradeoffs during the design
@@ -232,7 +233,7 @@ LIBC_INLINE UInt<MID_INT_SIZE> get_table_positive_df(int exponent, size_t i) {
232233 if (shift_amount < 0 ) {
233234 return 1 ;
234235 }
235- fputil::DyadicFloat<INT_SIZE> num (false , 0 , 1 );
236+ fputil::DyadicFloat<INT_SIZE> num (Sign::POS , 0 , 1 );
236237 constexpr UInt<INT_SIZE> MOD_SIZE =
237238 (UInt<INT_SIZE>(EXP10_9)
238239 << (CALC_SHIFT_CONST + (IDX_SIZE > 1 ? IDX_SIZE : 0 )));
@@ -242,16 +243,17 @@ LIBC_INLINE UInt<MID_INT_SIZE> get_table_positive_df(int exponent, size_t i) {
242243 0x89705f4136b4a597 }};
243244
244245 static const fputil::DyadicFloat<INT_SIZE> FIVE_EXP_MINUS_NINE (
245- false , -276 , FIVE_EXP_MINUS_NINE_MANT);
246+ Sign::POS , -276 , FIVE_EXP_MINUS_NINE_MANT);
246247
247248 if (i > 0 ) {
248- fputil::DyadicFloat<INT_SIZE> fives = fputil::pow_n (FIVE_EXP_MINUS_NINE, i);
249+ fputil::DyadicFloat<INT_SIZE> fives =
250+ fputil::pow_n (FIVE_EXP_MINUS_NINE, static_cast <uint32_t >(i));
249251 num = fives;
250252 }
251253 num = mul_pow_2 (num, shift_amount);
252254
253255 // Adding one is part of the formula.
254- UInt<INT_SIZE> int_num = static_cast <UInt<INT_SIZE>>( num) + 1 ;
256+ UInt<INT_SIZE> int_num = num. as_mantissa_type ( ) + 1 ;
255257 if (int_num > MOD_SIZE) {
256258 auto rem =
257259 int_num
@@ -339,23 +341,24 @@ LIBC_INLINE UInt<MID_INT_SIZE> get_table_negative_df(int exponent, size_t i) {
339341
340342 int shift_amount = CALC_SHIFT_CONST - exponent;
341343
342- fputil::DyadicFloat<INT_SIZE> num (false , 0 , 1 );
344+ fputil::DyadicFloat<INT_SIZE> num (Sign::POS , 0 , 1 );
343345 constexpr UInt<INT_SIZE> MOD_SIZE =
344346 (UInt<INT_SIZE>(EXP10_9)
345347 << (CALC_SHIFT_CONST + (IDX_SIZE > 1 ? IDX_SIZE : 0 )));
346348
347349 constexpr UInt<INT_SIZE> TEN_EXP_NINE_MANT (EXP10_9);
348350
349- static const fputil::DyadicFloat<INT_SIZE> TEN_EXP_NINE (false , 0 ,
351+ static const fputil::DyadicFloat<INT_SIZE> TEN_EXP_NINE (Sign::POS , 0 ,
350352 TEN_EXP_NINE_MANT);
351353
352354 if (i > 0 ) {
353- fputil::DyadicFloat<INT_SIZE> tens = fputil::pow_n (TEN_EXP_NINE, i);
355+ fputil::DyadicFloat<INT_SIZE> tens =
356+ fputil::pow_n (TEN_EXP_NINE, static_cast <uint32_t >(i));
354357 num = tens;
355358 }
356359 num = mul_pow_2 (num, shift_amount);
357360
358- UInt<INT_SIZE> int_num = static_cast <UInt<INT_SIZE>>( num);
361+ UInt<INT_SIZE> int_num = num. as_mantissa_type ( );
359362 if (int_num > MOD_SIZE) {
360363 auto rem =
361364 int_num
0 commit comments