summaryrefslogtreecommitdiffhomepage
path: root/dev/crt/math.hxx
diff options
context:
space:
mode:
authorAmlal <amlal@el-mahrouss-logic.com>2024-09-28 19:13:46 +0200
committerAmlal <amlal@el-mahrouss-logic.com>2024-09-28 19:13:46 +0200
commit421db65331663304466577b7187780d9eba18077 (patch)
tree3c7c4dc68537935b8cf98313e6a5bfe51786b7d2 /dev/crt/math.hxx
parentb6e416c9986bb545956a642d626e6aafd54f3b76 (diff)
feat: Add common XPCOM controls directory, restructure project, and introduce API breaking changes
- Added a new directory for common XPCOM controls to organize reusable components. - Restructured project layout for better modularity and maintainability. - Introduced API breaking changes in the process, requiring adjustments for backward compatibility. Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/crt/math.hxx')
-rw-r--r--dev/crt/math.hxx34
1 files changed, 16 insertions, 18 deletions
diff --git a/dev/crt/math.hxx b/dev/crt/math.hxx
index 5f55b430..56bb1236 100644
--- a/dev/crt/math.hxx
+++ b/dev/crt/math.hxx
@@ -6,24 +6,22 @@
#pragma once
-#include <NewKit/Defines.hxx>
+#include <crt/defines.hxx>
/// @file Math.hxx
/// @brief Math functions.
-namespace CRT
-{
- using namespace Kernel;
-
#ifdef __ZKA_USE_DOUBLE__
- typedef double Real;
+typedef double real_type;
#else
- typedef float Real;
+typedef float real_type;
#endif
+namespace std::math
+{
/// @brief Power function, with Repeat argument.
- template <SizeT Exponent>
- inline Real Pow(Real in)
+ template <size_t Exponent>
+ inline real_type pow(real_type in)
{
if (Exponent == 0)
return 1; // Any number to the power of 0 is 1.
@@ -31,11 +29,11 @@ namespace CRT
if (Exponent == 1)
return in; // Any number to the power of 1 is itself.
- UInt64 cnt = Exponent;
+ size_t cnt = Exponent;
- Real result = 1;
+ real_type result = 1;
- for (auto i = 0; i < (cnt); ++i)
+ for (auto i = 0; i < cnt; ++i)
result *= in;
return result;
@@ -43,22 +41,22 @@ namespace CRT
/// @brief Square of function, with Base template argument.
/// @param of Base argument to find sqquare of
- template <SizeT Base>
- inline Real SqrOf(Real in)
+ template <size_t Base>
+ inline real_type sqr(real_type in)
{
if (in == 0)
return 0;
- return Pow<1 / Base>(in);
+ return pow<1 / Base>(in);
}
/// @brief Linear interpolation equation solver.
/// @param from where?
/// @param to to?
/// @param Updated diff value according to difference.
- inline Real CGLerp(Real to, Real from, Real stat)
+ inline real_type lerp(real_type to, real_type from, real_type stat)
{
- Real diff = (to - from);
+ real_type diff = (to - from);
return from + (diff * stat);
}
-} // namespace CRT
+} // namespace std::math