AK: Always call memmove in Span instead of memcpy.

https://github.com/SerenityOS/serenity/pull/3166#discussion_r471031704
This commit is contained in:
asynts 2020-08-16 19:12:56 +02:00 committed by Andreas Kling
parent 5de131667a
commit aef6f00195
Notes: sideshowbarker 2024-07-19 03:32:07 +09:00

View file

@ -161,23 +161,12 @@ public:
}
ALWAYS_INLINE void copy_to(Span other) const
{
ASSERT(other.size() >= size());
__builtin_memcpy(other.data(), data(), sizeof(T) * size());
}
ALWAYS_INLINE void copy_trimmed_to(Span other) const
{
__builtin_memcpy(other.data(), data(), sizeof(T) * min(size(), other.size()));
}
ALWAYS_INLINE void move_to(Span other) const
{
ASSERT(other.size() >= size());
__builtin_memmove(other.data(), data(), sizeof(T) * size());
}
ALWAYS_INLINE void move_trimmed_to(Span other) const
ALWAYS_INLINE void copy_trimmed_to(Span other) const
{
__builtin_memmove(other.data(), data(), sizeof(T) * min(size(), other.size()));
}