summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-11-28 15:11:25 +0100
committerHenning Baldersheim <balder@oath.com>2018-11-28 15:11:25 +0100
commit76a13fa36614777c55f562490ecd160a2f5cfcbd (patch)
tree1ba0d6278b838d6235361d3a0f4a806b85a0157c /searchlib
parent2e6084a98ff0a929d4a923d7450dca2beeaee4e2 (diff)
Filter higher bits if not all are given.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h
index 976c39e71f8..f7f722264f8 100644
--- a/searchlib/src/vespa/searchlib/datastore/entryref.h
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.h
@@ -32,7 +32,11 @@ public:
EntryRef((bufferId_ << OffsetBits) + offset_) {}
EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {}
uint64_t offset() const { return _ref & (offsetSize()-1); }
- uint32_t bufferId() const { return _ref >> OffsetBits; }
+ uint32_t bufferId() const {
+ return ((OffsetBits + BufferBits) == 32u)
+ ? (_ref >> OffsetBits)
+ : ((_ref >> OffsetBits) & (numBuffers() - 1));
+ }
static uint64_t offsetSize() { return 1ul << OffsetBits; }
static uint32_t numBuffers() { return 1 << BufferBits; }
static uint64_t align(uint64_t val) { return val; }