summaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-12-04 11:48:41 +0100
committerGitHub <noreply@github.com>2018-12-04 11:48:41 +0100
commitae65645d128c8b936bc5722ea5360736c10c68b4 (patch)
treee28cf1c5e13b199e8a3bff8f4f22462cd06552d5 /searchlib/src
parent97f154211d3784bbe3467f18e6475c2c548693eb (diff)
Revert "Swap offset and bufferid for better and more compact hashing."
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/predicate/predicate_interval_store_test.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.h12
2 files changed, 5 insertions, 9 deletions
diff --git a/searchlib/src/tests/predicate/predicate_interval_store_test.cpp b/searchlib/src/tests/predicate/predicate_interval_store_test.cpp
index 461bfd9ef30..f90ed81cd7a 100644
--- a/searchlib/src/tests/predicate/predicate_interval_store_test.cpp
+++ b/searchlib/src/tests/predicate/predicate_interval_store_test.cpp
@@ -135,7 +135,7 @@ TEST("require that interval refs are reused for identical data.") {
PredicateIntervalStore store;
auto ref = store.insert<Interval>({{0x00010001}, {0x0002ffff}});
ASSERT_TRUE(ref.valid());
- ASSERT_EQUAL(0x02000001u, ref.ref());
+ ASSERT_EQUAL(0x02000040u, ref.ref());
auto ref2 = store.insert<Interval>({{0x00010001}, {0x0002ffff}});
EXPECT_EQUAL(ref.ref(), ref2.ref());
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h
index f7f722264f8..dc23349caad 100644
--- a/searchlib/src/vespa/searchlib/datastore/entryref.h
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.h
@@ -29,14 +29,10 @@ class EntryRefT : public EntryRef {
public:
EntryRefT() : EntryRef() {}
EntryRefT(uint64_t offset_, uint32_t bufferId_) :
- EntryRef((bufferId_ << OffsetBits) + offset_) {}
+ EntryRef((offset_ << BufferBits) + bufferId_) {}
EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {}
- uint64_t offset() const { return _ref & (offsetSize()-1); }
- uint32_t bufferId() const {
- return ((OffsetBits + BufferBits) == 32u)
- ? (_ref >> OffsetBits)
- : ((_ref >> OffsetBits) & (numBuffers() - 1));
- }
+ uint64_t offset() const { return _ref >> BufferBits; }
+ uint32_t bufferId() const { return _ref & (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; }
@@ -50,7 +46,7 @@ public:
template <uint32_t OffsetBits, uint32_t OffsetAlign>
class AlignedEntryRefT : public EntryRefT<OffsetBits> {
private:
- using ParentType = EntryRefT<OffsetBits>;
+ typedef EntryRefT<OffsetBits> ParentType;
static const uint32_t PadConstant = ((1 << OffsetAlign) - 1);
public:
AlignedEntryRefT() : ParentType() {}