Skip to content

Commit ee620a0

Browse files
committed
reduce registers pressure.
1 parent 6aea2fb commit ee620a0

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

include/fast_float/float_common.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,12 @@ struct adjusted_mantissa {
427427
int32_t power2; // a negative value indicates an invalid result
428428
adjusted_mantissa() noexcept = default;
429429

430+
fastfloat_really_inline
430431
constexpr bool operator==(adjusted_mantissa const &o) const noexcept {
431432
return mantissa == o.mantissa && power2 == o.power2;
432433
}
433434

435+
fastfloat_really_inline
434436
constexpr bool operator!=(adjusted_mantissa const &o) const noexcept {
435437
return mantissa != o.mantissa || power2 != o.power2;
436438
}
@@ -447,10 +449,10 @@ template <typename T, typename U = void> struct binary_format_lookup_tables;
447449
template <typename T> struct binary_format : binary_format_lookup_tables<T> {
448450
using equiv_uint = equiv_uint_t<T>;
449451

450-
static constexpr int mantissa_explicit_bits();
452+
static constexpr unsigned int mantissa_explicit_bits();
451453
static constexpr int minimum_exponent();
452454
static constexpr int infinite_power();
453-
static constexpr int sign_index();
455+
static constexpr unsigned int sign_index();
454456
static constexpr int
455457
min_exponent_fast_path(); // used when fegetround() == FE_TONEAREST
456458
static constexpr int max_exponent_fast_path();
@@ -462,7 +464,7 @@ template <typename T> struct binary_format : binary_format_lookup_tables<T> {
462464
static constexpr int largest_power_of_ten();
463465
static constexpr int smallest_power_of_ten();
464466
static constexpr T exact_power_of_ten(int64_t power);
465-
static constexpr size_t max_digits();
467+
static constexpr unsigned int max_digits();
466468
static constexpr equiv_uint exponent_mask();
467469
static constexpr equiv_uint mantissa_mask();
468470
static constexpr equiv_uint hidden_bit_mask();
@@ -570,12 +572,12 @@ inline constexpr int binary_format<float>::min_exponent_fast_path() {
570572
}
571573

572574
template <>
573-
inline constexpr int binary_format<double>::mantissa_explicit_bits() {
575+
inline constexpr unsigned int binary_format<double>::mantissa_explicit_bits() {
574576
return 52;
575577
}
576578

577579
template <>
578-
inline constexpr int binary_format<float>::mantissa_explicit_bits() {
580+
inline constexpr unsigned int binary_format<float>::mantissa_explicit_bits() {
579581
return 23;
580582
}
581583

@@ -617,11 +619,11 @@ template <> inline constexpr int binary_format<float>::infinite_power() {
617619

618620
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
619621

620-
template <> inline constexpr int binary_format<double>::sign_index() {
622+
template <> inline constexpr unsigned int binary_format<double>::sign_index() {
621623
return 63;
622624
}
623625

624-
template <> inline constexpr int binary_format<float>::sign_index() {
626+
template <> inline constexpr unsigned int binary_format<float>::sign_index() {
625627
return 31;
626628
}
627629

@@ -706,7 +708,7 @@ inline constexpr int binary_format<std::float16_t>::max_exponent_fast_path() {
706708
}
707709

708710
template <>
709-
inline constexpr int binary_format<std::float16_t>::mantissa_explicit_bits() {
711+
inline constexpr unsigned int binary_format<std::float16_t>::mantissa_explicit_bits() {
710712
return 10;
711713
}
712714

@@ -755,7 +757,7 @@ inline constexpr int binary_format<std::float16_t>::infinite_power() {
755757

756758
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
757759

758-
template <> inline constexpr int binary_format<std::float16_t>::sign_index() {
760+
template <> inline constexpr unsigned int binary_format<std::float16_t>::sign_index() {
759761
return 15;
760762
}
761763

@@ -772,7 +774,7 @@ inline constexpr int binary_format<std::float16_t>::smallest_power_of_ten() {
772774
}
773775

774776
template <>
775-
inline constexpr size_t binary_format<std::float16_t>::max_digits() {
777+
inline constexpr unsigned int binary_format<std::float16_t>::max_digits() {
776778
return 22;
777779
}
778780
#endif // __STDCPP_FLOAT16_T__
@@ -833,7 +835,7 @@ binary_format<std::bfloat16_t>::hidden_bit_mask() {
833835
}
834836

835837
template <>
836-
inline constexpr int binary_format<std::bfloat16_t>::mantissa_explicit_bits() {
838+
inline constexpr unsigned int binary_format<std::bfloat16_t>::mantissa_explicit_bits() {
837839
return 7;
838840
}
839841

@@ -899,7 +901,7 @@ inline constexpr int binary_format<std::bfloat16_t>::smallest_power_of_ten() {
899901
}
900902

901903
template <>
902-
inline constexpr size_t binary_format<std::bfloat16_t>::max_digits() {
904+
inline constexpr unsigned int binary_format<std::bfloat16_t>::max_digits() {
903905
return 98;
904906
}
905907
#endif // __STDCPP_BFLOAT16_T__
@@ -954,11 +956,11 @@ template <> inline constexpr int binary_format<float>::smallest_power_of_ten() {
954956
return -64;
955957
}
956958

957-
template <> inline constexpr size_t binary_format<double>::max_digits() {
959+
template <> inline constexpr unsigned int binary_format<double>::max_digits() {
958960
return 769;
959961
}
960962

961-
template <> inline constexpr size_t binary_format<float>::max_digits() {
963+
template <> inline constexpr unsigned int binary_format<float>::max_digits() {
962964
return 114;
963965
}
964966

0 commit comments

Comments
 (0)