Skip to content

Commit

Permalink
Merge pull request #41 from NHDaly/eval-maxexp10-Int128
Browse files Browse the repository at this point in the history
Prevent allocations for FD{Int128} by freezing max_exp10(Int128)
  • Loading branch information
TotalVerb authored Dec 14, 2018
2 parents 639e18b + 349643c commit 483325a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/FixedPointDecimals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ function max_exp10(::Type{T}) where {T <: Integer}
end

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

"""
coefficient(::Type{FD{T, f}}) -> T
Expand Down

0 comments on commit 483325a

Please sign in to comment.