Skip to content

Commit

Permalink
Add @propagate_inbounds to getindex/setindexi! on Vec (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: Sukera <Seelengrab@users.noreply.github.com>
  • Loading branch information
Seelengrab and Seelengrab authored Jan 13, 2023
1 parent 75e47c9 commit 705384c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/simdvec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ end
@inline Base.checkbounds(v::Vec, i::IntegerTypes) =
(i < 1 || i > length(v.data)) && Base.throw_boundserror(v, i)

function Base.getindex(v::Vec, i::IntegerTypes)
@propagate_inbounds function Base.getindex(v::Vec, i::IntegerTypes)
@boundscheck checkbounds(v, i)
return Intrinsics.extractelement(v.data, i-1)
end

@inline function Base.setindex(v::Vec{N,T}, x, i::IntegerTypes) where {N,T}
@propagate_inbounds function Base.setindex(v::Vec{N,T}, x, i::IntegerTypes) where {N,T}
@boundscheck checkbounds(v, i)
Vec(Intrinsics.insertelement(v.data, _unsafe_convert(T, x), i-1))
end
Expand Down

0 comments on commit 705384c

Please sign in to comment.