Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Use @inline instead of @generate when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Feb 12, 2017
1 parent 4dbce68 commit a2bb139
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,17 @@ function Base.getindex(pda::PooledDataArray, I::Real)
end
end

@generated function Base.getindex(pda::PooledDataArray, I::Integer...)
quote
if getindex(pda.refs, I...) == 0
return NA
else
return pda.pool[getindex(pda.refs, I...)]
end
@inline function Base.getindex(pda::PooledDataArray, I::Integer...)
if getindex(pda.refs, I...) == 0
return NA
else
return pda.pool[getindex(pda.refs, I...)]
end
end

# Vector case
@generated function Base.getindex(A::PooledDataArray, I::Union{AbstractVector,Colon}...)
quote
PooledDataArray(RefArray(getindex(A.refs, I...)), copy(A.pool))
end
@inline function Base.getindex(A::PooledDataArray, I::Union{AbstractVector,Colon}...)
PooledDataArray(RefArray(getindex(A.refs, I...)), copy(A.pool))
end

## setindex!: DataArray
Expand Down

0 comments on commit a2bb139

Please sign in to comment.