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

Commit

Permalink
annotate more indexing methods with @inline
Browse files Browse the repository at this point in the history
should have the same effect as @propagate_inbounds within @inbounds
blocks
  • Loading branch information
alyst committed Jul 12, 2017
1 parent 3e56713 commit 9643fb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ to store `v` at `I`.
end

# return the value of non-null X element wrapped in Nullable
function unsafe_getindex_notnull(X::NullableArray, I::Int...)
@inline function unsafe_getindex_notnull(X::NullableArray, I::Int...)
return Nullable(getindex(X.values, I...))
end
function unsafe_getindex_notnull{T}(X::AbstractArray{Nullable{T}}, I::Int...)
@inline function unsafe_getindex_notnull{T}(X::AbstractArray{Nullable{T}}, I::Int...)
return getindex(X, I...)
end

# return the value of non-null X element
function unsafe_getvalue_notnull(X::NullableArray, I::Int...)
@inline function unsafe_getvalue_notnull(X::NullableArray, I::Int...)
return getindex(X.values, I...)
end
function unsafe_getvalue_notnull{T}(X::AbstractArray{Nullable{T}}, I::Int...)
@inline function unsafe_getvalue_notnull{T}(X::AbstractArray{Nullable{T}}, I::Int...)
return get(getindex(X, I...))
end

Expand Down Expand Up @@ -142,6 +142,6 @@ end
This is a convenience method to set the entry of `X` at index `I` to be null
"""
function nullify!(X::NullableArray, I...)
@inline function nullify!(X::NullableArray, I...)
setindex!(X, Nullable{eltype(X)}(), I...)
end
6 changes: 3 additions & 3 deletions src/primitives.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Base.isnull(X::NullableArray, I::Int...) = X.isnull[I...]
Base.isnull{T}(X::AbstractArray{Nullable{T}}, I::Int...) = isnull(X[I...]) # fallback method
Base.values(X::NullableArray, I::Int...) = X.values[I...]
@inline Base.isnull(X::NullableArray, I::Int...) = X.isnull[I...]
@inline Base.isnull{T}(X::AbstractArray{Nullable{T}}, I::Int...) = isnull(X[I...]) # fallback method
@inline Base.values(X::NullableArray, I::Int...) = X.values[I...]

"""
size(X::NullableArray, [d::Real])
Expand Down

0 comments on commit 9643fb2

Please sign in to comment.