LibGfx: Use VectorN
dot product of self for length()
No functional changes.
This commit is contained in:
parent
582fb3f263
commit
dfe002cfd4
Notes:
sideshowbarker
2024-07-17 11:06:35 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/dfe002cfd4 Pull-request: https://github.com/SerenityOS/serenity/pull/13970 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/sunverwerth ✅
1 changed files with 1 additions and 5 deletions
|
@ -201,11 +201,7 @@ public:
|
|||
|
||||
[[nodiscard]] constexpr T length() const
|
||||
{
|
||||
T squared_sum {};
|
||||
UNROLL_LOOP
|
||||
for (auto i = 0u; i < N; ++i)
|
||||
squared_sum += m_data[i] * m_data[i];
|
||||
return AK::sqrt(squared_sum);
|
||||
return AK::sqrt(dot(*this));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr VectorN<2, T> xy() const requires(N >= 3)
|
||||
|
|
Loading…
Add table
Reference in a new issue