feature (kernel): implemented function to get absolute number
This commit is contained in:
parent
c15c42ca35
commit
42b331e3b0
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue