fixed index: chunk_from_offset: avoid slow modulo operation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e713ee5c56
commit
7e42ccdaf2
|
@ -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
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue