Re: [hackers] [libgrapheme] Mark likely branches || Laslo Hunhold
> +#ifdef __has_builtin
> + #if __has_builtin(__builtin_expect)
> + #define likely(expr) __builtin_expect(!!(expr), 1)
> + #define unlikely(expr) __builtin_expect(!!(expr), 0)
> + #else
> + #define likely(expr) (expr)
> + #define unlikely(expr) (expr)
> + #endif
> +#else
> + #define likely(expr) (expr)
> + #define unlikely(expr) (expr)
> +#endif
Just curious, why not use:
#if defined(__has_builtin) && __has_builtin(__builtin_expect)
#define likely(expr) __builtin_expect(!!(expr), 1)
#define unlikely(expr) __builtin_expect(!!(expr), 0)
#else
#define likely(expr) (expr)
#define unlikely(expr) (expr)
#endif
- NRK
Received on Tue Jan 04 2022 - 20:56:26 CET
This archive was generated by hypermail 2.3.0
: Tue Jan 04 2022 - 21:00:34 CET