mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Use __builtin_memmove for ByteBuffer and Span's overwrite
__builtin_memcpy will fail when the target area and the source area overlap. Using __builtin_memmove will handle this case as well.
This commit is contained in:
parent
59eb2d5de4
commit
e4a1bc1542
Notes:
sideshowbarker
2024-07-18 04:46:35 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/e4a1bc15426 Pull-request: https://github.com/SerenityOS/serenity/pull/9977 Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling
2 changed files with 2 additions and 2 deletions
|
@ -214,7 +214,7 @@ public:
|
|||
{
|
||||
// make sure we're not told to write past the end
|
||||
VERIFY(offset + data_size <= size());
|
||||
__builtin_memcpy(this->data() + offset, data, data_size);
|
||||
__builtin_memmove(this->data() + offset, data, data_size);
|
||||
}
|
||||
|
||||
void zero_fill()
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
{
|
||||
// make sure we're not told to write past the end
|
||||
VERIFY(offset + data_size <= size());
|
||||
__builtin_memcpy(this->data() + offset, data, data_size);
|
||||
__builtin_memmove(this->data() + offset, data, data_size);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE constexpr size_t copy_to(Span<RemoveConst<T>> other) const
|
||||
|
|
Loading…
Reference in a new issue