From 50abc18c8eae0328d544100237937e36eb3f2bf6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 19 Jul 2014 00:18:16 +0100 Subject: [PATCH] Add some more force inlines to some buffer methods --- src/buffer.hh | 2 ++ src/buffer.inl.hh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/buffer.hh b/src/buffer.hh index 2aa38ad30..c43e1ec05 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -177,9 +177,11 @@ private: struct LineList : std::vector { + [[gnu::always_inline]] String& operator[](LineCount line) { return std::vector::operator[]((int)line); } + [[gnu::always_inline]] const String& operator[](LineCount line) const { return std::vector::operator[]((int)line); } }; diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index f457eb0f7..e9993dcc6 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -6,6 +6,7 @@ namespace Kakoune { +[[gnu::always_inline]] inline char Buffer::byte_at(ByteCoord c) const { kak_assert(c.line < line_count() and c.column < m_lines[c.line].length()); @@ -82,6 +83,7 @@ inline BufferIterator Buffer::end() const return BufferIterator(*this, { line_count() - 1, m_lines.back().length() }); } +[[gnu::always_inline]] inline LineCount Buffer::line_count() const { return LineCount(m_lines.size()); @@ -148,6 +150,7 @@ inline bool BufferIterator::operator>=(const BufferIterator& iterator) const return (m_coord >= iterator.m_coord); } +[[gnu::always_inline]] inline char BufferIterator::operator*() const { return m_buffer->byte_at(m_coord);