Skip to content

Commit 483325a

Browse files
authored
Merge pull request #41 from NHDaly/eval-maxexp10-Int128
Prevent allocations for FD{Int128} by freezing max_exp10(Int128)
2 parents 639e18b + 349643c commit 483325a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/FixedPointDecimals.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ function max_exp10(::Type{T}) where {T <: Integer}
490490
end
491491

492492
max_exp10(::Type{BigInt}) = -1
493+
# Freeze the evaluation for Int128, since max_exp10(Int128) is too compilicated to get
494+
# optimized away by the compiler during const-folding.
495+
@eval max_exp10(::Type{Int128}) = $(max_exp10(Int128))
493496

494497
"""
495498
coefficient(::Type{FD{T, f}}) -> T

0 commit comments

Comments
 (0)