Skip to content

Commit

Permalink
Fix: replace size with capacity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Dijkstra (JUD) committed Sep 19, 2024
1 parent 708ff3d commit 545bb69
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/with_alloc/alloc_ringbuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ unsafe impl<T> RingBuffer<T> for AllocRingBuffer<T> {
{
let normalized_index = self.readptr + range.start.rem_euclid(self.len());
let index = normalized_index % self.buffer_size();
let buf = unsafe { slice::from_raw_parts(self.buf, self.buffer_size()) };
let buf = unsafe { slice::from_raw_parts(self.buf, self.capacity()) };
buf[index..]
.iter()
.chain(buf[..index].iter())
Expand Down
2 changes: 1 addition & 1 deletion src/with_const_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ unsafe impl<T, const CAP: usize> RingBuffer<T> for ConstGenericRingBuffer<T, CAP
T: 'a,
{
let normalized_index = self.readptr + range.start.rem_euclid(self.len());
let index = normalized_index % self.buffer_size();
let index = normalized_index % self.capacity();
self.buf[index..]
.iter()
.chain(self.buf[..index].iter())
Expand Down

0 comments on commit 545bb69

Please sign in to comment.