@@ -14,23 +14,9 @@ function (self::Type{FixedSizeArray{T,N}})(::UndefInitializer, size::Vararg{Int,
14
14
return FixedSizeArray (Memory {T} (undef, prod (size)), size)
15
15
end
16
16
17
- Base. @propagate_inbounds function Base. setindex! (A:: FixedSizeArray{T} , x, i:: Int ) where {T}
18
- getfield (A, :mem )[i] = x
19
- return A
20
- end
21
- Base. @inline function Base. setindex! (A:: FixedSizeArray{T} , x, i1:: Int , i2:: Int , I:: Int... ) where {T}
22
- @boundscheck checkbounds (A, i1, i2, I... ) # generally _to_linear_index requires bounds checking
23
- getfield (A, :mem )[Base. _to_linear_index (A, i1, i2, I... )] = x
24
- return A
25
- end
26
- Base. @propagate_inbounds function Base. getindex (A:: FixedSizeArray , i:: Int )
27
- getfield (A, :mem )[i]
28
- end
29
- function Base. getindex (A:: FixedSizeArray , i1:: Int , i2:: Int , I:: Int... )
30
- @inline
31
- @boundscheck checkbounds (A, i1, i2, I... ) # generally _to_linear_index requires bounds checking
32
- return @inbounds A[Base. _to_linear_index (A, i1, i2, I... )]
33
- end
17
+ Base. IndexStyle (:: Type{<:FixedSizeArray} ) = IndexLinear ()
18
+ Base. @propagate_inbounds Base. getindex (A:: FixedSizeArray , i:: Int ) = A. mem[i]
19
+ Base. @propagate_inbounds Base. setindex! (A:: FixedSizeArray , v, i:: Int ) = A. mem[i] = v
34
20
35
21
Base. size (a:: FixedSizeArray ) = getfield (a, :size )
36
22
0 commit comments