mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
util: likely() and unlikely() macros
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user