mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
AK: Always call memmove in Span instead of memcpy.
https://github.com/SerenityOS/serenity/pull/3166#discussion_r471031704
This commit is contained in:
parent
5de131667a
commit
aef6f00195
1 changed files with 1 additions and 12 deletions
13
AK/Span.h
13
AK/Span.h
|
@ -161,23 +161,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void copy_to(Span other) const
|
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());
|
ASSERT(other.size() >= size());
|
||||||
__builtin_memmove(other.data(), data(), sizeof(T) * 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()));
|
__builtin_memmove(other.data(), data(), sizeof(T) * min(size(), other.size()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue