Skip to content

Commit f1bafe3

Browse files
committed
Merge pull request #42 from JeffBezanson/teh/functorize
Resolve functor deprecation
2 parents 3964895 + 4332649 commit f1bafe3

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
julia 0.4
2+
Compat 0.7.14

src/FixedPointNumbers.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ __precompile__()
22

33
module FixedPointNumbers
44

5-
using Base: IdFun, AddFun, MulFun, reducedim_initarray
5+
using Base: reducedim_initarray
66

77
import 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
1619
abstract FixedPoint{T <: Integer, f} <: Real
@@ -62,14 +65,15 @@ include("deprecations.jl")
6265

6366
# Promotions for reductions
6467
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)
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

Comments
 (0)