mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 06:49:12 +03:00
LibGfx: Implement copy-assign for Matrix
This used to generate a warning about using a deprecated copy-assign, default-generated by the compiler, and deprecated because we hand- implement the copy-constructor. This warning is correct, since the default-generated copy-assign may or may not be as efficient as memcpy. This patch gets rid of the warning, and has either no performance impact or a slightly positive one. If this turns out to be wrong, we should probably also fix the copy-constructor.
This commit is contained in:
parent
fd8300e52d
commit
ee18912373
Notes:
sideshowbarker
2024-07-18 02:51:09 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/ee18912373c Pull-request: https://github.com/SerenityOS/serenity/pull/10421 Reviewed-by: https://github.com/linusg
@ -38,6 +38,12 @@ public:
|
||||
__builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N);
|
||||
}
|
||||
|
||||
Matrix& operator=(const Matrix& other)
|
||||
{
|
||||
__builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N);
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr auto elements() const { return m_elements; }
|
||||
constexpr auto elements() { return m_elements; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user