small change
This commit is contained in:
parent
8f326565a5
commit
809bee4a86
|
@ -89,7 +89,7 @@ impl<T, const N: usize> RingQueue<T, N> {
|
|||
}
|
||||
unsafe { *self.elem[self.tail].as_mut_ptr() = value };
|
||||
self.tail = self.tail.wrapping_add(1);
|
||||
// > -> >=
|
||||
// '>' -> '>='
|
||||
if self.tail >= N || self.tail == 0 {
|
||||
self.tail = self.tail.wrapping_sub(N);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl<T, const N: usize> RingQueue<T, N> {
|
|||
}
|
||||
let value = unsafe { ptr::read(self.elem[self.front].as_ptr()) };
|
||||
self.front = self.front.wrapping_add(1); // assured non empty
|
||||
// > -> >=
|
||||
// '>' -> '>='
|
||||
if self.front >= N || self.front == 0 {
|
||||
self.front = self.front.wrapping_sub(N);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue