Skip to content

Commit 7ca9c84

Browse files
committed
type usage fixes.
1 parent 8f79501 commit 7ca9c84

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

include/fast_float/float_common.h

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ struct is_supported_char_type
317317

318318
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
319319

320-
// TODO use SSE4.2 there when SSE2 compiler switch in MSVC
321-
// or in other compiler SSE4.2 available.
320+
// TODO? use SSE4.2 there when SSE2 compiler switch in MSVC
321+
// or in other compiler SSE4.2 available?
322322

323323
// Compares two ASCII strings in a case insensitive manner.
324324
template <typename UC>
@@ -556,8 +556,8 @@ template <typename T> struct binary_format : binary_format_lookup_tables<T> {
556556
static constexpr am_bits_t max_exponent_fast_path();
557557
static constexpr am_pow_t max_exponent_round_to_even();
558558
static constexpr am_pow_t min_exponent_round_to_even();
559-
static constexpr equiv_uint max_mantissa_fast_path(am_pow_t const power);
560-
static constexpr equiv_uint
559+
static constexpr am_mant_t max_mantissa_fast_path(am_pow_t const power);
560+
static constexpr am_mant_t
561561
max_mantissa_fast_path(); // used when fegetround() == FE_TONEAREST
562562
static constexpr am_pow_t largest_power_of_ten();
563563
static constexpr am_pow_t smallest_power_of_ten();
@@ -738,10 +738,14 @@ inline constexpr am_bits_t binary_format<float>::max_exponent_fast_path() {
738738
return 10;
739739
}
740740

741-
template <typename T>
742-
inline constexpr typename binary_format<T>::equiv_uint
743-
binary_format<T>::max_mantissa_fast_path() {
744-
return binary_format<T>::equiv_uint(2) << mantissa_explicit_bits();
741+
template <>
742+
inline constexpr am_mant_t binary_format<double>::max_mantissa_fast_path() {
743+
return am_mant_t(2) << mantissa_explicit_bits();
744+
}
745+
746+
template <>
747+
inline constexpr am_mant_t binary_format<float>::max_mantissa_fast_path() {
748+
return am_mant_t(2) << mantissa_explicit_bits();
745749
}
746750

747751
// credit: Jakub Jelínek
@@ -810,7 +814,13 @@ binary_format<std::float16_t>::mantissa_explicit_bits() {
810814
}
811815

812816
template <>
813-
inline constexpr binary_format<std::float16_t>::equiv_uint
817+
inline constexpr am_mant_t
818+
binary_format<std::float16_t>::max_mantissa_fast_path() {
819+
return am_mant_t(2) << mantissa_explicit_bits();
820+
}
821+
822+
template <>
823+
inline constexpr am_mant_t
814824
binary_format<std::float16_t>::max_mantissa_fast_path(am_pow_t power) {
815825
// caller is responsible to ensure that
816826
FASTFLOAT_ASSUME(power >= 0 && power <= 4);
@@ -894,7 +904,7 @@ constexpr std::bfloat16_t
894904
binary_format_lookup_tables<std::bfloat16_t, U>::powers_of_ten[];
895905

896906
template <typename U>
897-
constexpr uint64_t
907+
constexpr uint16_t
898908
binary_format_lookup_tables<std::bfloat16_t, U>::max_mantissa[];
899909

900910
#endif
@@ -937,7 +947,13 @@ binary_format<std::bfloat16_t>::mantissa_explicit_bits() {
937947
}
938948

939949
template <>
940-
inline constexpr binary_format<std::bfloat16_t>::equiv_uint
950+
inline constexpr am_mant_t
951+
binary_format<std::bfloat16_t>::max_mantissa_fast_path() {
952+
return am_mant_t(2) << mantissa_explicit_bits();
953+
}
954+
955+
template <>
956+
inline constexpr am_mant_t
941957
binary_format<std::bfloat16_t>::max_mantissa_fast_path(am_pow_t power) {
942958
// caller is responsible to ensure that
943959
FASTFLOAT_ASSUME(power >= 0 && power <= 3);
@@ -1002,7 +1018,7 @@ inline constexpr am_digits binary_format<std::bfloat16_t>::max_digits() {
10021018
#endif // __STDCPP_BFLOAT16_T__
10031019

10041020
template <>
1005-
inline constexpr binary_format<double>::equiv_uint
1021+
inline constexpr am_mant_t
10061022
binary_format<double>::max_mantissa_fast_path(am_pow_t power) {
10071023
// caller is responsible to ensure that
10081024
FASTFLOAT_ASSUME(power >= 0 && power <= 22);
@@ -1012,7 +1028,7 @@ binary_format<double>::max_mantissa_fast_path(am_pow_t power) {
10121028
}
10131029

10141030
template <>
1015-
inline constexpr binary_format<float>::equiv_uint
1031+
inline constexpr am_mant_t
10161032
binary_format<float>::max_mantissa_fast_path(am_pow_t power) {
10171033
// caller is responsible to ensure that
10181034
FASTFLOAT_ASSUME(power >= 0 && power <= 10);

0 commit comments

Comments
 (0)