util: likely() and unlikely() macros

This commit is contained in:
Matheus
2024-10-05 11:31:22 -03:00
parent fe1e24b3ea
commit a8a40ac032
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -9,6 +9,9 @@
#define ROUND_DOWN(v, n) ((v) - ((v) % (n)))
#define ROUND_UP(v, n) ROUND_DOWN((v) + (n) - 1, n)
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
static inline long abs(long x) {
return x < 0 ? -x : x;
}