1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:17:44 +00:00

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`.
This commit is contained in:
Hendiadyoin1 2022-02-03 12:48:17 +01:00 committed by Andreas Kling
parent 47fe911196
commit cd21e03225
6 changed files with 30 additions and 10 deletions

View file

@ -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();