Skip to content

Commit

Permalink
tweak types
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiahpslewis committed Mar 27, 2024
1 parent 6fd05e6 commit da410ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/CircularArrayBuffers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ function Base.push!(cb::CircularArrayBuffer{T,N}, data) where {T,N}
return cb
end

function Base.push!(cb::CircularArrayBuffer{T,1}, data) where {T}
function Base.push!(cb::CircularVectorBuffer{T}, data) where {T}
_update_first_and_nframes!(cb)
i = _buffer_frame(cb, cb.nframes)
cb.buffer[i:i] .= Ref(data)
return cb
end

function Base.append!(cb::CircularArrayBuffer{T,N}, data::D) where {T,N,D}
function Base.append!(cb::CircularArrayBuffer{T,N}, data) where {T,N}
d, r = divrem(length(data), cb.step_size)
@assert r == 0
if length(data) >= length(cb.buffer)
Expand Down Expand Up @@ -185,7 +186,7 @@ function Base.pop!(cb::CircularArrayBuffer{T,N}) where {T,N}
else
res = @views cb.buffer[ntuple(_ -> (:), N - 1)..., _buffer_frame(cb, cb.nframes)]
cb.nframes -= 1
res
return res
end
end

Expand All @@ -199,7 +200,7 @@ function Base.popfirst!(cb::CircularArrayBuffer{T,N}) where {T,N}
if cb.first > capacity(cb)
cb.first = 1
end
res
return res
end
end

Expand Down

0 comments on commit da410ca

Please sign in to comment.