[libc][NFC] Remove FloatProperties (#76508)
Access is now done through `FPBits` exclusively. This patch also renames a few internal structs and uses `T` instead of `FP` as a template parameter.
This commit is contained in:
committed by
GitHub
parent
b7d5b0d0ee
commit
c09e690556
@@ -22,18 +22,17 @@
|
||||
|
||||
#include "utils/MPFRWrapper/mpfr_inc.h"
|
||||
|
||||
using LIBC_NAMESPACE::fputil::FloatProperties;
|
||||
using LIBC_NAMESPACE::fputil::FPBits;
|
||||
|
||||
// This function calculates the effective precision for a given float type and
|
||||
// exponent. Subnormals have a lower effective precision since they don't
|
||||
// necessarily use all of the bits of the mantissa.
|
||||
template <typename F> inline constexpr int effective_precision(int exponent) {
|
||||
const int full_precision = FloatProperties<F>::MANTISSA_PRECISION;
|
||||
const int full_precision = FPBits<F>::MANTISSA_PRECISION;
|
||||
|
||||
// This is intended to be 0 when the exponent is the lowest normal and
|
||||
// increase as the exponent's magnitude increases.
|
||||
const int bits_below_normal =
|
||||
(-exponent) - (FloatProperties<F>::EXP_BIAS - 1);
|
||||
const int bits_below_normal = (-exponent) - (FPBits<F>::EXP_BIAS - 1);
|
||||
|
||||
// The precision should be the normal, full precision, minus the bits lost
|
||||
// by this being a subnormal, minus one for the implicit leading one.
|
||||
|
||||
Reference in New Issue
Block a user