Skip to content

Commit

Permalink
inbounds
Browse files Browse the repository at this point in the history
  • Loading branch information
bramtayl committed Sep 7, 2021
1 parent 9551f82 commit 5a5f7f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/JuliennedArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ end
function slice_index(slices, indices)
setindex_unrolled(axes(slices.whole), indices, map(not, slices.alongs))
end
@inline function getindex(
@inline @propagate_inbounds function getindex(
slices::Slices{Item,Dimensions},
indices::Vararg{Int,Dimensions},
) where {Item,Dimensions}
view(slices.whole, slice_index(slices, indices)...)
end
@inline function setindex!(
@inline @propagate_inbounds function setindex!(
slices::Slices{Item,Dimensions},
value,
indices::Vararg{Int,Dimensions},
) where {Item,Dimensions}
slices.whole[slice_index(slices, indices)...] = value
end

@inline function axis_or_1(switch, axis)
function axis_or_1(switch, axis)
if untyped(switch)
axis
else
Expand Down Expand Up @@ -339,14 +339,14 @@ function split_indices(aligned, indices)
getindex_unrolled(indices, map(not, aligned.alongs)),
getindex_unrolled(indices, aligned.alongs)
end
@inline function getindex(
@inline @propagate_inbounds function getindex(
aligned::Align{Item,Dimensions},
indices::Vararg{Int,Dimensions},
) where {Item,Dimensions}
outer, inner = split_indices(aligned, indices)
aligned.slices[outer...][inner...]
end
@inline function setindex!(
@inline @propagate_inbounds function setindex!(
aligned::Align{Item,Dimensions},
value,
indices::Vararg{Int,Dimensions},
Expand Down Expand Up @@ -394,7 +394,7 @@ ERROR: ArgumentError: Axes of [1, 2] does not match the axes of the first slice:
[...]
```
"""
function Align(
@inline @propagate_inbounds function Align(
slices::AbstractArray{<:AbstractArray{Item,InnerDimensions},OuterDimensions},
alongs::TypedBool...,
) where {Item,InnerDimensions,OuterDimensions}
Expand Down Expand Up @@ -462,7 +462,7 @@ julia> @inferred align_1_3(slices)
6 8
```
"""
@inline function Align(
@inline @propagate_inbounds function Align(
slices::AbstractArray{<:AbstractArray{Item,InnerDimensions},OuterDimensions},
alongs::Int...,
) where {Item,InnerDimensions,OuterDimensions}
Expand Down

2 comments on commit 5a5f7f7

@bramtayl
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.2.2 already exists and points to a different commit"

Please sign in to comment.