summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-23 19:21:20 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-05-23 19:21:20 +0000
commit230336fa21bb6c73e06dc2c4c9abcaa9208d6673 (patch)
tree5b86338c2045c05e39f3265e989608e09ba07fe0
parent82bea8313f493bc8f790633e0c3aee213f4612b7 (diff)
Move calcNewSize to implementation file.
-rw-r--r--vespalib/src/vespa/vespalib/util/rcuvector.h9
-rw-r--r--vespalib/src/vespa/vespalib/util/rcuvector.hpp10
2 files changed, 12 insertions, 7 deletions
diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.h b/vespalib/src/vespa/vespalib/util/rcuvector.h
index 1c5cad8ea90..5d084fe3815 100644
--- a/vespalib/src/vespa/vespalib/util/rcuvector.h
+++ b/vespalib/src/vespa/vespalib/util/rcuvector.h
@@ -49,13 +49,8 @@ private:
GrowStrategy _growStrategy;
GenerationHolderType &_genHolder;
- size_t calcNewSize(size_t baseSize) const {
- size_t delta = (baseSize * _growStrategy.getGrowPercent() / 100) + _growStrategy.getGrowDelta();
- return baseSize + std::max(delta, static_cast<size_t>(1));
- }
- size_t calcNewSize() const {
- return calcNewSize(_data.capacity());
- }
+ size_t calcNewSize(size_t baseSize) const;
+ size_t calcNewSize() const;
void expand(size_t newCapacity);
void expandAndInsert(const T & v);
void update_vector_start();
diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.hpp b/vespalib/src/vespa/vespalib/util/rcuvector.hpp
index decaf774e88..3c76ed22471 100644
--- a/vespalib/src/vespa/vespalib/util/rcuvector.hpp
+++ b/vespalib/src/vespa/vespalib/util/rcuvector.hpp
@@ -18,6 +18,16 @@ template <typename T>
RcuVectorHeld<T>::~RcuVectorHeld() = default;
template <typename T>
+size_t RcuVectorBase<T>::calcNewSize(size_t baseSize) const {
+ size_t delta = (baseSize * _growStrategy.getGrowFactor()) + _growStrategy.getGrowDelta();
+ return baseSize + std::max(delta, static_cast<size_t>(1));
+}
+template <typename T>
+size_t RcuVectorBase<T>::calcNewSize() const {
+ return calcNewSize(_data.capacity());
+}
+
+template <typename T>
void
RcuVectorBase<T>::unsafe_resize(size_t n) {
_data.resize(n);