Fixed bugs

This commit is contained in:
Igor Katson 2021-06-25 23:50:10 +01:00
parent 87d6fe27ce
commit 0a640daba4
3 changed files with 88 additions and 67 deletions

View file

@ -113,6 +113,9 @@ impl Lengths {
}
self.piece_length
}
pub const fn chunk_absolute_offset(&self, chunk_info: &ChunkInfo) -> u64 {
self.piece_offset(chunk_info.piece_index) + chunk_info.offset as u64
}
pub const fn piece_offset(&self, index: ValidPieceIndex) -> u64 {
index.0 as u64 * self.piece_length as u64
}