summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-05-08 01:48:16 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-09 21:49:48 +0200
commitdfe002cfd4282361ee622a5ec2e17d8968bf84e4 (patch)
tree80c1a38b527fbc456f88ae321bbbe13e7b232de6 /Userland/Libraries/LibGfx
parent582fb3f263e78ead074f20a23533b85b3a737abd (diff)
downloadserenity-dfe002cfd4282361ee622a5ec2e17d8968bf84e4.zip
LibGfx: Use `VectorN` dot product of self for `length()`
No functional changes.
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/VectorN.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/Userland/Libraries/LibGfx/VectorN.h b/Userland/Libraries/LibGfx/VectorN.h
index 56f5aafa02..0ef9d383e1 100644
--- a/Userland/Libraries/LibGfx/VectorN.h
+++ b/Userland/Libraries/LibGfx/VectorN.h
@@ -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)