summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/Matrix4x4.h
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2022-02-03 12:48:17 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-15 11:39:42 +0100
commitcd21e0322510bdd95c5d53075f80c49efcb2f24d (patch)
treec735ef5b046067f3da5fd961b6b74600451b4b5b /Userland/Libraries/LibGfx/Matrix4x4.h
parent47fe911196b5551f5b4a829a1a310ca66cf12e99 (diff)
downloadserenity-cd21e0322510bdd95c5d53075f80c49efcb2f24d.zip
AK+Everywhere: Add sincos and use it in some places
Calculating sin and cos at once is quite a bit cheaper than calculating them individually. x87 has even a dedicated instruction for it: `fsincos`.
Diffstat (limited to 'Userland/Libraries/LibGfx/Matrix4x4.h')
-rw-r--r--Userland/Libraries/LibGfx/Matrix4x4.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/Matrix4x4.h b/Userland/Libraries/LibGfx/Matrix4x4.h
index 4637f4e816..4e0c6dda8c 100644
--- a/Userland/Libraries/LibGfx/Matrix4x4.h
+++ b/Userland/Libraries/LibGfx/Matrix4x4.h
@@ -70,8 +70,8 @@ constexpr static Matrix4x4<T> scale_matrix(const Vector3<T>& s)
template<typename T>
constexpr static Matrix4x4<T> rotation_matrix(const Vector3<T>& axis, T angle)
{
- T c = AK::cos(angle);
- T s = AK::sin(angle);
+ T c, s;
+ AK::sincos(angle, s, c);
T t = 1 - c;
T x = axis.x();
T y = axis.y();