Skip to content

Commit 3270ad5

Browse files
committed
Improve perf: don't force-promote inside *()
This allows BigInt * Int to avoid allocating another BigInt.
1 parent 41a69fd commit 3270ad5

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
@@ -194,8 +194,8 @@ end
194194

195195
# these functions are needed to avoid InexactError when converting from the
196196
# integer type
197-
Base.:*(x::Integer, y::FD{T, f}) where {T, f} = reinterpret(FD{T, f}, *(promote(x, y.i)...))
198-
Base.:*(x::FD{T, f}, y::Integer) where {T, f} = reinterpret(FD{T, f}, *(promote(x.i, y)...))
197+
Base.:*(x::Integer, y::FD{T, f}) where {T, f} = reinterpret(FD{T, f}, *(x, y.i))
198+
Base.:*(x::FD{T, f}, y::Integer) where {T, f} = reinterpret(FD{T, f}, *(x.i, y))
199199

200200
function Base.:/(x::FD{T, f}, y::FD{T, f}) where {T, f}
201201
powt = coefficient(FD{T, f})

0 commit comments

Comments
 (0)