summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/TypedTransfer.h5
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;
}