Function lastN [src]
Retrieve the n-th last byte
Prototype
pub fn lastN(self: CircularBuffer, dist: usize) !u8 Parameters
self: CircularBufferdist: usize Source
pub fn lastN(self: CircularBuffer, dist: usize) !u8 {
if (dist > self.dict_size or dist > self.len) {
return error.CorruptInput;
}
const offset = (self.dict_size + self.cursor - dist) % self.dict_size;
return self.get(offset);
}