1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-27 05:33:17 +03:00

Add some more force inlines to some buffer methods

This commit is contained in:
Maxime Coste 2014-07-19 00:18:16 +01:00
parent 6c581b7054
commit 50abc18c8e
2 changed files with 5 additions and 0 deletions

View File

@ -177,9 +177,11 @@ private:
struct LineList : std::vector<String> struct LineList : std::vector<String>
{ {
[[gnu::always_inline]]
String& operator[](LineCount line) String& operator[](LineCount line)
{ return std::vector<String>::operator[]((int)line); } { return std::vector<String>::operator[]((int)line); }
[[gnu::always_inline]]
const String& operator[](LineCount line) const const String& operator[](LineCount line) const
{ return std::vector<String>::operator[]((int)line); } { return std::vector<String>::operator[]((int)line); }
}; };

View File

@ -6,6 +6,7 @@
namespace Kakoune namespace Kakoune
{ {
[[gnu::always_inline]]
inline char Buffer::byte_at(ByteCoord c) const inline char Buffer::byte_at(ByteCoord c) const
{ {
kak_assert(c.line < line_count() and c.column < m_lines[c.line].length()); 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() }); return BufferIterator(*this, { line_count() - 1, m_lines.back().length() });
} }
[[gnu::always_inline]]
inline LineCount Buffer::line_count() const inline LineCount Buffer::line_count() const
{ {
return LineCount(m_lines.size()); return LineCount(m_lines.size());
@ -148,6 +150,7 @@ inline bool BufferIterator::operator>=(const BufferIterator& iterator) const
return (m_coord >= iterator.m_coord); return (m_coord >= iterator.m_coord);
} }
[[gnu::always_inline]]
inline char BufferIterator::operator*() const inline char BufferIterator::operator*() const
{ {
return m_buffer->byte_at(m_coord); return m_buffer->byte_at(m_coord);