From 67c9dc06ca0b5aec6430d50af9444bbe85b6deb5 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 16 Apr 2022 20:27:46 +0300 Subject: initial thread id handling + At least initial in the sense that this seems like the smartest way to handle things, that is. --- include/apos/utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/apos/utils.h') diff --git a/include/apos/utils.h b/include/apos/utils.h index e060c44..af0534a 100644 --- a/include/apos/utils.h +++ b/include/apos/utils.h @@ -31,6 +31,14 @@ #define offsetof(type, member) ((size_t) & ((type *)0)->member) #endif +#if __has_builtin(__builtin_expect) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) (x) +#define unlikely(x) (x) +#endif + #define container_of(ptr, type, member) \ ((type *)((char *)(ptr)-offsetof(type, member))) -- cgit v1.3