AK: Fast path for single-element TypedTransfer::copy

Co-Authored-By: Brian Gianforcaro <bgianf@serenityos.org>
This commit is contained in:
kleines Filmröllchen 2021-12-17 12:36:25 +01:00 committed by Brian Gianforcaro
parent d5dce448ea
commit 3891d6d73a
Notes: sideshowbarker 2024-07-17 22:40:31 +09:00

View File

@ -37,7 +37,10 @@ public:
return 0; return 0;
if constexpr (Traits<T>::is_trivial()) { if constexpr (Traits<T>::is_trivial()) {
__builtin_memmove(destination, source, count * sizeof(T)); if (count == 1)
*destination = *source;
else
__builtin_memmove(destination, source, count * sizeof(T));
return count; return count;
} }