util: abs

This commit is contained in:
Matheus
2023-05-03 22:40:37 -03:00
parent c1c84cffbb
commit 17d4200cd4
+4
View File
@@ -4,4 +4,8 @@
#define ROUND_DOWN(v, n) ((v) - ((v) % (n)))
#define ROUND_UP(v, n) ROUND_DOWN((v) + (n) - 1, n)
static inline long abs(long x) {
return x < 0 ? -x : x;
}
#endif