neptune/kern/libkern/util.h
2025-09-04 05:00:09 +02:00

15 lines
345 B
C

#ifndef UTIL_H
#define UTIL_H
/*
* Give hints to the compiler for branch prediction optimization.
*/
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
#define likely(c) (__builtin_expect(!!(c), 1))
#define unlikely(c) (__builtin_expect(!!(c), 0))
#else
#define likely(c) (c)
#define unlikely(c) (c)
#endif
#endif // UTIL_H