feature (kernel): implemented function to get absolute number

This commit is contained in:
antifallobst 2023-02-11 15:59:51 +01:00
parent c15c42ca35
commit 42b331e3b0
2 changed files with 8 additions and 0 deletions

View File

@ -24,5 +24,6 @@
#define FLOOR_TO(a, b) (a - (a % b)) #define FLOOR_TO(a, b) (a - (a % b))
uint64_t pow(uint64_t base, uint64_t exp); uint64_t pow(uint64_t base, uint64_t exp);
uint64_t abs(int64_t n);
#endif //NOX_MATH_H #endif //NOX_MATH_H

View File

@ -22,3 +22,10 @@ uint64_t pow(uint64_t base, uint64_t exp) {
} }
return n; return n;
} }
uint64_t abs(int64_t n) {
if (n < 0) {
return n * -1;
}
return n;
}