Skip to content

Commit

Permalink
fix(ThingBuf): fix backwards subtraction in len
Browse files Browse the repository at this point in the history
Signed-off-by: Eliza Weisman <[email protected]>
  • Loading branch information
hawkw committed Nov 29, 2021
1 parent 1c28c84 commit caab6b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl Core {
let (head_idx, _) = self.idx_gen(head);
let (tail_idx, _) = self.idx_gen(tail);
return match head_idx.cmp(&tail_idx) {
cmp::Ordering::Less => head_idx - tail_idx,
cmp::Ordering::Less => tail_idx - head_idx,
cmp::Ordering::Greater => self.capacity - head_idx + tail_idx,
_ if tail == head => 0,
_ => self.capacity,
Expand Down

0 comments on commit caab6b2

Please sign in to comment.