@@ -2,7 +2,7 @@ __precompile__()
22
33module FixedPointNumbers
44
5- using Base: IdFun, AddFun, MulFun, reducedim_initarray
5+ using Base: reducedim_initarray
66
77import Base: == , < , <= , - , + , * , / , ~ ,
88 convert, promote_rule, show, showcompact, isinteger, abs, decompose,
@@ -11,6 +11,9 @@ import Base: ==, <, <=, -, +, *, /, ~,
1111 trunc, round, floor, ceil, bswap,
1212 div, fld, rem, mod, mod1, rem1, fld1, min, max, minmax,
1313 start, next, done, r_promote, reducedim_init
14+
15+ using Compat
16+
1417# T => BaseType
1518# f => Number of Bytes reserved for fractional part
1619abstract FixedPoint{T <: Integer , f} <: Real
@@ -62,14 +65,15 @@ include("deprecations.jl")
6265
6366# Promotions for reductions
6467const Treduce = Float64
65- for F in (AddFun, MulFun)
66- @eval r_promote {T} (:: $F , x:: FixedPoint{T} ) = Treduce (x)
67- end
68+ r_promote {T} (:: typeof (@functorize (+ )), x:: FixedPoint{T} ) = Treduce (x)
69+ r_promote {T} (:: typeof (@functorize (* )), x:: FixedPoint{T} ) = Treduce (x)
6870
69- reducedim_init {T<:FixedPoint} (f:: IdFun , op:: AddFun ,
71+ reducedim_init {T<:FixedPoint} (f:: typeof (@functorize (identity)),
72+ op:: typeof (@functorize (+ )),
7073 A:: AbstractArray{T} , region) =
7174 reducedim_initarray (A, region, zero (Treduce))
72- reducedim_init {T<:FixedPoint} (f:: IdFun , op:: MulFun ,
75+ reducedim_init {T<:FixedPoint} (f:: typeof (@functorize (identity)),
76+ op:: typeof (@functorize (* )),
7377 A:: AbstractArray{T} , region) =
7478 reducedim_initarray (A, region, one (Treduce))
7579
0 commit comments