mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:17:34 +00:00
AK: Add ALWAYS_INLINE, NEVER_INLINE and FLATTEN macros
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
This commit is contained in:
parent
f1a8fb1e88
commit
888e35f0fe
14 changed files with 63 additions and 56 deletions
|
@ -38,20 +38,20 @@ class StringView {
|
|||
public:
|
||||
using ConstIterator = const char*;
|
||||
|
||||
[[gnu::always_inline]] inline StringView() { }
|
||||
[[gnu::always_inline]] inline StringView(const char* characters, size_t length)
|
||||
ALWAYS_INLINE StringView() { }
|
||||
ALWAYS_INLINE StringView(const char* characters, size_t length)
|
||||
: m_characters(characters)
|
||||
, m_length(length)
|
||||
{
|
||||
ASSERT(!Checked<uintptr_t>::addition_would_overflow((uintptr_t)characters, length));
|
||||
}
|
||||
[[gnu::always_inline]] inline StringView(const unsigned char* characters, size_t length)
|
||||
ALWAYS_INLINE StringView(const unsigned char* characters, size_t length)
|
||||
: m_characters((const char*)characters)
|
||||
, m_length(length)
|
||||
{
|
||||
ASSERT(!Checked<uintptr_t>::addition_would_overflow((uintptr_t)characters, length));
|
||||
}
|
||||
[[gnu::always_inline]] inline StringView(const char* cstring)
|
||||
ALWAYS_INLINE StringView(const char* cstring)
|
||||
: m_characters(cstring)
|
||||
, m_length(cstring ? __builtin_strlen(cstring) : 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue