fixed index: chunk_from_offset: avoid slow modulo operation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
		@ -212,7 +212,7 @@ impl IndexFile for FixedIndexReader {
 | 
			
		||||
 | 
			
		||||
        Some((
 | 
			
		||||
            (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
 | 
			
		||||
        ))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user