summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-11-27 12:03:14 +0100
committerHenning Baldersheim <balder@oath.com>2018-11-28 12:35:05 +0100
commit6a3d5aa235c9666a3c534b7da02fc3e2f7ddf2e7 (patch)
tree449ecd81ed9f90fbfe9491ff1ae4cfd96e04bc5b /searchlib
parentc287dc1409d34b281af89ab0fed04e4342e76518 (diff)
Swap offset and bufferid for better and more compact hashing.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h
index dc23349caad..976c39e71f8 100644
--- a/searchlib/src/vespa/searchlib/datastore/entryref.h
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.h
@@ -29,10 +29,10 @@ class EntryRefT : public EntryRef {
public:
EntryRefT() : EntryRef() {}
EntryRefT(uint64_t offset_, uint32_t bufferId_) :
- EntryRef((offset_ << BufferBits) + bufferId_) {}
+ EntryRef((bufferId_ << OffsetBits) + offset_) {}
EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {}
- uint64_t offset() const { return _ref >> BufferBits; }
- uint32_t bufferId() const { return _ref & (numBuffers() - 1); }
+ uint64_t offset() const { return _ref & (offsetSize()-1); }
+ uint32_t bufferId() const { return _ref >> OffsetBits; }
static uint64_t offsetSize() { return 1ul << OffsetBits; }
static uint32_t numBuffers() { return 1 << BufferBits; }
static uint64_t align(uint64_t val) { return val; }
@@ -46,7 +46,7 @@ public:
template <uint32_t OffsetBits, uint32_t OffsetAlign>
class AlignedEntryRefT : public EntryRefT<OffsetBits> {
private:
- typedef EntryRefT<OffsetBits> ParentType;
+ using ParentType = EntryRefT<OffsetBits>;
static const uint32_t PadConstant = ((1 << OffsetAlign) - 1);
public:
AlignedEntryRefT() : ParentType() {}