@@ -2,7 +2,7 @@ __precompile__()
2
2
3
3
module FixedPointNumbers
4
4
5
- using Base: IdFun, AddFun, MulFun, reducedim_initarray
5
+ using Base: reducedim_initarray
6
6
7
7
import Base: == , < , <= , - , + , * , / , ~ ,
8
8
convert, promote_rule, show, showcompact, isinteger, abs, decompose,
@@ -11,6 +11,9 @@ import Base: ==, <, <=, -, +, *, /, ~,
11
11
trunc, round, floor, ceil, bswap,
12
12
div, fld, rem, mod, mod1, rem1, fld1, min, max, minmax,
13
13
start, next, done, r_promote, reducedim_init
14
+
15
+ using Compat
16
+
14
17
# T => BaseType
15
18
# f => Number of Bytes reserved for fractional part
16
19
abstract FixedPoint{T <: Integer , f} <: Real
@@ -62,14 +65,15 @@ include("deprecations.jl")
62
65
63
66
# Promotions for reductions
64
67
const 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)
68
70
69
- reducedim_init {T<:FixedPoint} (f:: IdFun , op:: AddFun ,
71
+ reducedim_init {T<:FixedPoint} (f:: typeof (@functorize (identity)),
72
+ op:: typeof (@functorize (+ )),
70
73
A:: AbstractArray{T} , region) =
71
74
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 (* )),
73
77
A:: AbstractArray{T} , region) =
74
78
reducedim_initarray (A, region, one (Treduce))
75
79
0 commit comments