diff options
author | kleines Filmröllchen <malu.bertsch@gmail.com> | 2021-12-17 12:36:25 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-17 13:13:00 -0800 |
commit | 3891d6d73afd6408314eeb27713dad0f45718310 (patch) | |
tree | 6235344930c9eadb3a0886e03c7da054cb5cb98b /AK | |
parent | d5dce448ea679e40348ac77869f73374d3c89ae6 (diff) | |
download | serenity-3891d6d73afd6408314eeb27713dad0f45718310.zip |
AK: Fast path for single-element TypedTransfer::copy
Co-Authored-By: Brian Gianforcaro <bgianf@serenityos.org>
Diffstat (limited to 'AK')
-rw-r--r-- | AK/TypedTransfer.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/AK/TypedTransfer.h b/AK/TypedTransfer.h index 91045a9da9..64ed7fb274 100644 --- a/AK/TypedTransfer.h +++ b/AK/TypedTransfer.h @@ -37,7 +37,10 @@ public: return 0; 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; } |