Skip to content

Commit

Permalink
(Ringbuffer) fix buffer growth error
Browse files Browse the repository at this point in the history
  • Loading branch information
tlecomte committed Oct 18, 2015
1 parent b90f50d commit 37d7ee7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions friture/ringbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def grow_if_needed(self, length):
old_offset_mod = self.offset % old_length
new_offset_mod = self.offset % new_length
shift = new_offset_mod - old_offset_mod
#shift can be negative, computing modulo again
shift %= new_length
# first copy, always complete
newbuffer[:, shift:shift + old_length] = self.buffer[:, :old_length]
# second copy, can be folded
Expand Down

0 comments on commit 37d7ee7

Please sign in to comment.