diff options
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/stllike/lrucache_map.h | 12 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/lrucache_map.h b/vespalib/src/vespa/vespalib/stllike/lrucache_map.h index ffb7a427d11..6758b62d2c2 100644 --- a/vespalib/src/vespa/vespalib/stllike/lrucache_map.h +++ b/vespalib/src/vespa/vespalib/stllike/lrucache_map.h @@ -11,8 +11,8 @@ namespace vespalib { struct LinkedValueBase { static const uint32_t npos = static_cast<uint32_t>(-1); - LinkedValueBase() : _prev(npos), _next(npos) { } - LinkedValueBase(uint32_t prev, uint32_t next) : _prev(prev), _next(next) { } + constexpr LinkedValueBase() noexcept : _prev(npos), _next(npos) { } + constexpr LinkedValueBase(uint32_t prev, uint32_t next) noexcept : _prev(prev), _next(next) { } uint32_t _prev; uint32_t _next; }; @@ -20,9 +20,9 @@ struct LinkedValueBase { template<typename V> struct LinkedValue : public LinkedValueBase { - LinkedValue() {} - LinkedValue(const V & v) : LinkedValueBase(), _value(v) { } - LinkedValue(V && v) : LinkedValueBase(), _value(std::move(v)) { } + constexpr LinkedValue() noexcept {} + constexpr LinkedValue(const V & v) noexcept : LinkedValueBase(), _value(v) { } + constexpr LinkedValue(V && v) noexcept : LinkedValueBase(), _value(std::move(v)) { } V _value; }; @@ -151,7 +151,7 @@ public: * Tell if an object with given key exists in the cache. * Does not alter the LRU list. */ - bool hasKey(const K & key) const { return HashTable::find(key) != HashTable::end(); } + bool hasKey(const K & key) const __attribute__((noinline)); /** * Called when an object is inserted, to see if the LRU should be removed. diff --git a/vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp b/vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp index ccaae52469e..ca1b075d68b 100644 --- a/vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp +++ b/vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp @@ -266,6 +266,12 @@ lrucache_map<P>::operator [] (const K & key) } template< typename P > +bool +lrucache_map<P>::hasKey(const K & key) const { + return HashTable::find(key) != HashTable::end(); +} + +template< typename P > typename P::Value * lrucache_map<P>::findAndRef(const K & key) { |