diff --git a/kernel/inc/utils/math.h b/kernel/inc/utils/math.h index 42523da..bd506a4 100644 --- a/kernel/inc/utils/math.h +++ b/kernel/inc/utils/math.h @@ -24,5 +24,6 @@ #define FLOOR_TO(a, b) (a - (a % b)) uint64_t pow(uint64_t base, uint64_t exp); +uint64_t abs(int64_t n); #endif //NOX_MATH_H diff --git a/kernel/src/utils/math.c b/kernel/src/utils/math.c index 8af2d8b..1695705 100644 --- a/kernel/src/utils/math.c +++ b/kernel/src/utils/math.c @@ -21,4 +21,11 @@ uint64_t pow(uint64_t base, uint64_t exp) { n *= base; } return n; +} + +uint64_t abs(int64_t n) { + if (n < 0) { + return n * -1; + } + return n; } \ No newline at end of file