mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
AK: Mark some DoublyLinkedList and Vector methods ALWAYS_INLINE
This commit is contained in:
committed by
Ali Mohammad Pur
parent
0d5363caff
commit
46e38ffcc5
Notes:
github-actions[bot]
2026-02-06 10:44:52 +00:00
Author: https://github.com/alimpfard Commit: https://github.com/LadybirdBrowser/ladybird/commit/46e38ffcc58 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7477 Reviewed-by: https://github.com/Hendiadyoin1
@@ -115,7 +115,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
ErrorOr<void> try_append(Args&&... args)
|
||||
ALWAYS_INLINE ErrorOr<void> try_append(Args&&... args)
|
||||
{
|
||||
static_assert(
|
||||
requires { T(forward<Args>(args)...); }, "Initializer is missing.");
|
||||
@@ -281,11 +281,11 @@ private:
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
Node* make_node(Args&&... args)
|
||||
ALWAYS_INLINE Node* make_node(Args&&... args)
|
||||
{
|
||||
if constexpr (node_cache_size > 0) {
|
||||
if (m_node_cache.used_count > 0) {
|
||||
auto* node = m_node_cache.nodes[--m_node_cache.used_count];
|
||||
auto* node = m_node_cache.nodes.data()[--m_node_cache.used_count];
|
||||
new (node) Node(forward<Args>(args)...);
|
||||
return node;
|
||||
}
|
||||
|
||||
10
AK/Vector.h
10
AK/Vector.h
@@ -753,7 +753,7 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> try_append(T&& value)
|
||||
ALWAYS_INLINE ErrorOr<void> try_append(T&& value)
|
||||
{
|
||||
TRY(try_grow_capacity(size() + 1));
|
||||
if constexpr (contains_reference)
|
||||
@@ -765,13 +765,13 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> try_append(T const& value)
|
||||
ALWAYS_INLINE ErrorOr<void> try_append(T const& value)
|
||||
requires(!contains_reference)
|
||||
{
|
||||
return try_append(T(value));
|
||||
}
|
||||
|
||||
ErrorOr<void> try_append(StorageType const* values, size_t count)
|
||||
ALWAYS_INLINE ErrorOr<void> try_append(StorageType const* values, size_t count)
|
||||
{
|
||||
if (count == 0)
|
||||
return {};
|
||||
@@ -837,7 +837,7 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> try_grow_capacity(size_t needed_capacity)
|
||||
ALWAYS_INLINE ErrorOr<void> try_grow_capacity(size_t needed_capacity)
|
||||
{
|
||||
if (m_capacity >= needed_capacity)
|
||||
return {};
|
||||
@@ -1061,7 +1061,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void reset_capacity()
|
||||
ALWAYS_INLINE void reset_capacity()
|
||||
{
|
||||
m_capacity = inline_capacity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user