From 17d4200cd465942b38e347948a80cf9c108926e1 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 3 May 2023 22:40:37 -0300 Subject: [PATCH] util: abs --- kernel-src/include/util.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel-src/include/util.h b/kernel-src/include/util.h index 8acc3223..287bfea0 100644 --- a/kernel-src/include/util.h +++ b/kernel-src/include/util.h @@ -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