Skip to content

Commit 6c9de9e

Browse files
committed
improve state and buffer
1 parent c160f95 commit 6c9de9e

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/buffer/buffer.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ Base.lastindex(b::Buffer) = lastindex(parent(b))
2121
Base.@propagate_inbounds Base.setindex!(b::Buffer, v, i) = (parent(b)[i] = b.map.(v))
2222

2323
function Buffer(def::T, size; map::G = Base.identity) where {T, G}
24-
return Buffer{T, AbstractVector{T}, G}(fill(def, size), map)
24+
return Buffer(fill(def, size), map)
2525
end
2626
function Buffer(vec::AbstractVector{T}; map::G = Base.identity) where {T, G}
27-
return Buffer{T, AbstractVector{T}, G}(vec, map)
27+
return Buffer(vec, map)
2828
end
2929

3030
function coordinate_transformer(b::Buffer)
3131
return b.map
3232
end
3333

34+
3435
# """
3536
# Buffer{T, A<:AbstractVector{T}, G}
3637
# extends Buffer by storing the previous values before they are updated.

src/state.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ mutable struct State{S, B <: Buffer, F, C <: Integer, A<:AbstractVector{S}}
77
end
88

99
position(state::State) = state.position
10-
function Base.getindex(state::State, i)
10+
Base.@propagate_inbounds function Base.getindex(state::State, i)
1111
return state.position[i]
1212
end
13-
function Base.setindex!(state::State, v, i)
13+
Base.@propagate_inbounds function Base.setindex!(state::State, v, i)
1414
state.bare_position[i] = v
1515
return state.position[i] = v
1616
end

0 commit comments

Comments
 (0)