aboutsummaryrefslogtreecommitdiff
path: root/zenstore/compactcas.h
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/compactcas.h')
-rw-r--r--zenstore/compactcas.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/zenstore/compactcas.h b/zenstore/compactcas.h
index 91c7c6981..95c98bd01 100644
--- a/zenstore/compactcas.h
+++ b/zenstore/compactcas.h
@@ -36,11 +36,17 @@ struct CasDiskLocation
constexpr static uint32_t MaxBlockIndex = (1ul << CasDiskLocation::MaxBlockIndexBits) - 1ul;
constexpr static uint32_t MaxOffset = (1ul << CasDiskLocation::MaxOffsetBits) - 1ul;
- explicit CasDiskLocation(const CasLocation& Location) { Init(Location.BlockIndex, Location.Offset, Location.Size); }
+ CasDiskLocation(const CasLocation& Location, uint64_t OffsetAlignement)
+ {
+ Init(Location.BlockIndex, Location.Offset / OffsetAlignement, Location.Size);
+ }
CasDiskLocation() = default;
- inline CasLocation operator*() const { return {.BlockIndex = BlockIndex(), .Offset = Offset(), .Size = Size()}; }
+ inline CasLocation Get(uint64_t OffsetAlignement) const
+ {
+ return {.BlockIndex = BlockIndex(), .Offset = Offset() * OffsetAlignement, .Size = Size()};
+ }
private:
inline uint32_t BlockIndex() const { return (static_cast<uint32_t>(m_BlockIndexAndOffsetHighBits & 0xf) << 16) | m_BlockIndexLowBits; }