fixed index: chunk_from_offset: avoid slow modulo operation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-22 17:46:02 +02:00
parent e713ee5c56
commit 7e42ccdaf2

View File

@ -212,7 +212,7 @@ impl IndexFile for FixedIndexReader {
Some(( Some((
(offset / self.chunk_size as u64) as usize, (offset / self.chunk_size as u64) as usize,
offset % self.chunk_size as u64 offset & (self.chunk_size - 1) as u64 // fast modulo, valid for 2^x chunk_size
)) ))
} }
} }