@@ -123,17 +123,16 @@ end
123
123
# Custom widemul implementation to avoid the cost of widening to BigInt.
124
124
# FD{Int128} operations should widen to 256 bits internally, rather than to a BigInt.
125
125
const BitInteger128 = Union{Int128, UInt128}
126
- _widemul (x, y) = widemul (x, y)
127
- _widemul (x:: BitInteger128 , y) = _widemul (promote (x, y)... )
128
- _widemul (x, y:: BitInteger128 ) = _widemul (promote (x, y)... )
129
- _widemul (x:: Int128 , y:: Int128 ) = BitIntegers. Int256 (x) * BitIntegers. Int256 (y)
130
- _widemul (x:: UInt128 , y:: UInt128 ) = BitIntegers. UInt256 (x) * BitIntegers. UInt256 (y)
126
+ _widemul (x, y) = _widen (x) * _widen (y)
127
+ _widemul (x:: Signed ,y:: Unsigned ) = _widen (x) * signed (_widen (y))
128
+ _widemul (x:: Unsigned ,y:: Signed ) = signed (_widen (x)) * _widen (y)
131
129
132
130
# Custom widen implementation to avoid the cost of widening to BigInt.
133
131
# FD{Int128} operations should widen to 256 bits internally, rather than to a BigInt.
134
132
_widen (:: Type{Int128} ) = BitIntegers. Int256
135
133
_widen (:: Type{UInt128} ) = BitIntegers. UInt256
136
- _widen (t) = widen (t)
134
+ _widen (t:: Type ) = widen (t)
135
+ _widen (x:: T ) where {T} = (_widen (T))(x)
137
136
138
137
139
138
(:: Type{T} )(x:: Real ) where {T <: FD } = convert (T, x)
0 commit comments