From e9af3a4217843974c1e9c89bb8ddcfee44216c9e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 14 May 2015 19:05:41 +0100 Subject: [PATCH] always_inline a few methods --- src/array_view.hh | 2 ++ src/diff.hh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/array_view.hh b/src/array_view.hh index 922cd99a8..33ae8979f 100644 --- a/src/array_view.hh +++ b/src/array_view.hh @@ -44,6 +44,8 @@ public: constexpr T* pointer() const { return m_pointer; } constexpr size_t size() const { return m_size; } + + [[gnu::always_inline]] constexpr T& operator[](size_t n) const { return *(m_pointer + n); } constexpr T* begin() const { return m_pointer; } diff --git a/src/diff.hh b/src/diff.hh index e68ec10c4..da1328e23 100644 --- a/src/diff.hh +++ b/src/diff.hh @@ -18,7 +18,9 @@ struct MirroredArray : public ArrayView (*this)[i] = 0; } + [[gnu::always_inline]] T& operator[](int n) { return ArrayView::operator[](n + size); } + [[gnu::always_inline]] const T& operator[](int n) const { return ArrayView::operator[](n + size); } private: int size;