AK: Use TypedTransfer in Span::overwrite()

Using `__builtin_memmove` was unsafe if items in source buffer are not
trivially copyable.
This commit is contained in:
Aliaksandr Kalenik 2025-04-23 17:15:08 +02:00 committed by Andreas Kling
parent 005551b530
commit cd9e491742

View File

@ -187,7 +187,7 @@ public:
{
// make sure we're not told to write past the end
VERIFY(offset + data_size <= size() * sizeof(T));
__builtin_memmove(this->data() + offset, data, data_size);
TypedTransfer<T>::copy(this->data() + offset, static_cast<T const*>(data), data_size / sizeof(T));
}
ALWAYS_INLINE constexpr size_t copy_to(Span<RemoveConst<T>> other) const