summaryrefslogtreecommitdiff
path: root/AK/Math.h
diff options
context:
space:
mode:
Diffstat (limited to 'AK/Math.h')
-rw-r--r--AK/Math.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/AK/Math.h b/AK/Math.h
index fcdc2f0d5a..625dff549c 100644
--- a/AK/Math.h
+++ b/AK/Math.h
@@ -204,6 +204,20 @@ constexpr T cos(T angle)
}
template<FloatingPoint T>
+constexpr void sincos(T angle, T& sin_val, T& cos_val)
+{
+ if (is_constant_evaluated()) {
+ sin_val = sin(angle);
+ cos_val = cos(angle);
+ return;
+ }
+ asm(
+ "fsincos"
+ : "=t"(cos_val), "=u"(sin_val)
+ : "0"(angle));
+}
+
+template<FloatingPoint T>
constexpr T tan(T angle)
{
CONSTEXPR_STATE(tan, angle);
@@ -303,6 +317,7 @@ using Trigonometry::atan2;
using Trigonometry::cos;
using Trigonometry::hypot;
using Trigonometry::sin;
+using Trigonometry::sincos;
using Trigonometry::tan;
namespace Exponentials {