diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-07 21:54:50 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-07 21:54:50 +0000 |
commit | bbdb900d9d450515604c31192edf26a2d19e3d40 (patch) | |
tree | f8b70def82e7a3e144bb694a0b26d9a8c44d3f57 /vespalib | |
parent | ec06a46d765cb491e695b2c34eb6ed7264498337 (diff) |
Reduce branch miss predictions.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/datastorebase.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.h b/vespalib/src/vespa/vespalib/datastore/datastorebase.h index 6af3f0ba034..bce2d2096f2 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastorebase.h +++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.h @@ -105,22 +105,22 @@ public: void reclaim_all_memory(); template <typename EntryType, typename RefType> - EntryType *getEntry(RefType ref) { + EntryType *getEntry(RefType ref) noexcept { return static_cast<EntryType *>(_buffers[ref.bufferId()].get_buffer_relaxed()) + ref.offset(); } template <typename EntryType, typename RefType> - const EntryType *getEntry(RefType ref) const { + const EntryType *getEntry(RefType ref) const noexcept { return static_cast<const EntryType *>(_buffers[ref.bufferId()].get_buffer_acquire()) + ref.offset(); } template <typename EntryType, typename RefType> - EntryType *getEntryArray(RefType ref, size_t arraySize) { + EntryType *getEntryArray(RefType ref, size_t arraySize) noexcept { return static_cast<EntryType *>(_buffers[ref.bufferId()].get_buffer_relaxed()) + (ref.offset() * arraySize); } template <typename EntryType, typename RefType> - const EntryType *getEntryArray(RefType ref, size_t arraySize) const { + const EntryType *getEntryArray(RefType ref, size_t arraySize) const noexcept { return static_cast<const EntryType *>(_buffers[ref.bufferId()].get_buffer_acquire()) + (ref.offset() * arraySize); } |