summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-01-11 17:47:12 +0100
committerGitHub <noreply@github.com>2019-01-11 17:47:12 +0100
commitca9ebfc0f18371d4d41c56feae18884601c2ad90 (patch)
tree9be1ad0e3dc4d3a7fae1af930f1bea2f96a7ed5b /searchlib
parent64d7ba0cf6afbbb125a9b888d456f151cab890f2 (diff)
parentc8839683871b492772cd355204620a6d11dd59c8 (diff)
Merge pull request #8119 from vespa-engine/balder/move-assert-to-cpp
Add implementation file.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/datastore/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.h8
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.hpp18
4 files changed, 37 insertions, 7 deletions
diff --git a/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt b/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt
index 0698c57246a..5af7bd21d78 100644
--- a/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/datastore/CMakeLists.txt
@@ -6,5 +6,6 @@ vespa_add_library(searchlib_datastore OBJECT
bufferstate.cpp
datastore.cpp
datastorebase.cpp
+ entryref.cpp
DEPENDS
)
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.cpp b/searchlib/src/vespa/searchlib/datastore/entryref.cpp
new file mode 100644
index 00000000000..f7224191d1b
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.cpp
@@ -0,0 +1,17 @@
+// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "entryref.hpp"
+
+namespace search::datastore {
+
+template EntryRefT<24u, 8u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<31u, 1u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<22u,10u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<19u,13u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<18u, 6u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<15u,17u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<10u,22u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT<10u,10u>::EntryRefT(uint64_t, uint32_t);
+template EntryRefT< 3u, 2u>::EntryRefT(uint64_t, uint32_t);
+
+}
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h
index f4dec5dbef3..457ffac4e26 100644
--- a/searchlib/src/vespa/searchlib/datastore/entryref.h
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.h
@@ -3,7 +3,6 @@
#pragma once
#include <cstdint>
-#include <vespa/vespalib/util/assert.h>
namespace search::datastore {
@@ -28,12 +27,7 @@ template <uint32_t OffsetBits, uint32_t BufferBits = 32u - OffsetBits>
class EntryRefT : public EntryRef {
public:
EntryRefT() : EntryRef() {}
- EntryRefT(uint64_t offset_, uint32_t bufferId_) :
- EntryRef((offset_ << BufferBits) + bufferId_)
- {
- ASSERT_ONCE_OR_LOG(offset_ < offsetSize(), "EntryRefT.offset_overflow", 10000);
- ASSERT_ONCE_OR_LOG(bufferId_ < numBuffers(), "EntryRefT.bufferId_overflow", 10000);
- }
+ EntryRefT(uint64_t offset_, uint32_t bufferId_);
EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {}
uint32_t hash() const { return offset() + (bufferId() << OffsetBits); }
uint64_t offset() const { return _ref >> BufferBits; }
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.hpp b/searchlib/src/vespa/searchlib/datastore/entryref.hpp
new file mode 100644
index 00000000000..a7bb9f9b3ef
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/datastore/entryref.hpp
@@ -0,0 +1,18 @@
+// Copyright 2019 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "entryref.h"
+#include <vespa/vespalib/util/assert.h>
+
+namespace search::datastore {
+
+template <uint32_t OffsetBits, uint32_t BufferBits>
+EntryRefT<OffsetBits, BufferBits>::EntryRefT(uint64_t offset_, uint32_t bufferId_) :
+ EntryRef((offset_ << BufferBits) + bufferId_)
+{
+ ASSERT_ONCE_OR_LOG(offset_ < offsetSize(), "EntryRefT.offset_overflow", 10000);
+ ASSERT_ONCE_OR_LOG(bufferId_ < numBuffers(), "EntryRefT.bufferId_overflow", 10000);
+}
+
+}