* Improving in code generation -> speedup.

* fix warning in 32 bit build.
This commit is contained in:
IRainman 2025-11-08 18:14:39 +03:00
parent 97045b1d14
commit 56d423399d
3 changed files with 8 additions and 8 deletions

View File

@ -122,7 +122,7 @@ uint64_t simd_read8_to_u64(UC const *) {
}
// credit @aqrit
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint64_t
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t
parse_eight_digits_unrolled(uint64_t val) noexcept {
constexpr uint64_t mask = 0x000000FF000000FF;
constexpr uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
@ -130,12 +130,12 @@ parse_eight_digits_unrolled(uint64_t val) noexcept {
val -= 0x3030303030303030;
val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
return val;
return uint32_t(val);
}
// Call this if chars are definitely 8 digits.
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint64_t
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint32_t
parse_eight_digits_unrolled(UC const *chars) noexcept {
if (cpp20_and_in_constexpr() || !has_simd_opt<UC>()) {
return parse_eight_digits_unrolled(read8_to_u64(chars)); // truncation okay

View File

@ -604,11 +604,11 @@ struct bigint : pow5_tables<> {
exp -= large_step;
}
#ifdef FASTFLOAT_64BIT_LIMB
limb_t const small_step = 27;
limb const max_native = 7450580596923828125UL;
limb_t constexpr small_step = 27;
limb constexpr max_native = 7450580596923828125UL;
#else
limb_t const small_step = 13;
limb const max_native = 1220703125U;
limb_t constexpr small_step = 13;
limb constexpr max_native = 1220703125U;
#endif
while (exp >= small_step) {
FASTFLOAT_TRY(small_mul(vec, max_native));

View File

@ -260,7 +260,7 @@ round_up_bigint(bigint &big, am_digits &count) noexcept {
// parse the significant digits into a big integer
template <typename T, typename UC>
inline FASTFLOAT_CONSTEXPR20 am_digits
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits
parse_mantissa(bigint &result, const parsed_number_string_t<UC> &num) noexcept {
// try to minimize the number of big integer and scalar multiplication.
// therefore, try to parse 8 digits at a time, and multiply by the largest