Skip to content

Commit 341c931

Browse files
committed
Allow max_exp10 to const fold by marking it Base.@pure
1 parent 40d1439 commit 341c931

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/FixedPointDecimals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ end
467467
The highest value of `x` which does not result in an overflow when evaluating `T(10)^x`. For
468468
types of `T` that do not overflow -1 will be returned.
469469
"""
470-
function max_exp10(::Type{T}) where {T <: Integer}
470+
Base.@pure function max_exp10(::Type{T}) where {T <: Integer}
471471
W = widen(T)
472472
type_max = W(typemax(T))
473473

@@ -484,7 +484,7 @@ function max_exp10(::Type{T}) where {T <: Integer}
484484
end
485485

486486
max_exp10(::Type{BigInt}) = -1
487-
@eval max_exp10(::Type{Int128}) = $(max_exp10(Int128)) # Freeze this, since it's not getting Const folded.
487+
#@eval max_exp10(::Type{Int128}) = $(max_exp10(Int128)) # Freeze this, since it's not getting Const folded.
488488

489489
"""
490490
coefficient(::Type{FD{T, f}}) -> T

0 commit comments

Comments
 (0)