@@ -10,7 +10,7 @@ import Base: ==, <, <=, -, +, *, /, ~, isapprox,
10
10
zero, oneunit, one, typemin, typemax, realmin, realmax, eps, sizeof, reinterpret,
11
11
float, trunc, round, floor, ceil, bswap,
12
12
div, fld, rem, mod, mod1, fld1, min, max, minmax,
13
- start, next, done, reducedim_init, rand
13
+ start, next, done, rand
14
14
if isdefined (Base, :rem1 )
15
15
import Base: rem1
16
16
end
@@ -134,20 +134,27 @@ sizeof(::Type{T}) where {T <: FixedPoint} = sizeof(rawtype(T))
134
134
# Promotions for reductions
135
135
const Treduce = Float64
136
136
if isdefined (Base, :r_promote )
137
+ # Julia v0.6
137
138
Base. r_promote (:: typeof (+ ), x:: FixedPoint{T} ) where {T} = Treduce (x)
138
139
Base. r_promote (:: typeof (* ), x:: FixedPoint{T} ) where {T} = Treduce (x)
140
+ Base. reducedim_init (f:: typeof (identity),
141
+ op:: typeof (+ ),
142
+ A:: AbstractArray{T} , region) where {T <: FixedPoint } =
143
+ Base. reducedim_initarray (A, region, zero (Treduce))
144
+ Base. reducedim_init (f:: typeof (identity),
145
+ op:: typeof (* ),
146
+ A:: AbstractArray{T} , region) where {T <: FixedPoint } =
147
+ Base. reducedim_initarray (A, region, oneunit (Treduce))
139
148
else
140
- Base. promote_sys_size (:: Type{<:FixedPoint} ) = Treduce
149
+ # Julia v0.7
150
+ Base. add_sum (x:: FixedPoint , y:: FixedPoint ) = Treduce (x) + Treduce (y)
151
+ Base. reduce_empty (:: typeof (Base. add_sum), :: Type{F} ) where {F<: FixedPoint } = zero (Treduce)
152
+ Base. reduce_first (:: typeof (Base. add_sum), x:: FixedPoint ) = Treduce (x)
153
+ Base. mul_prod (x:: FixedPoint , y:: FixedPoint ) = Treduce (x) * Treduce (y)
154
+ Base. reduce_empty (:: typeof (Base. mul_prod), :: Type{F} ) where {F<: FixedPoint } = one (Treduce)
155
+ Base. reduce_first (:: typeof (Base. mul_prod), x:: FixedPoint ) = Treduce (x)
141
156
end
142
157
143
- reducedim_init (f:: typeof (identity),
144
- op:: typeof (+ ),
145
- A:: AbstractArray{T} , region) where {T <: FixedPoint } =
146
- reducedim_initarray (A, region, zero (Treduce))
147
- reducedim_init (f:: typeof (identity),
148
- op:: typeof (* ),
149
- A:: AbstractArray{T} , region) where {T <: FixedPoint } =
150
- reducedim_initarray (A, region, oneunit (Treduce))
151
158
152
159
for f in (:div , :fld , :fld1 )
153
160
@eval begin
0 commit comments