On Wed, Jan 05, 2022 at 01:56:26AM +0600, NRK wrote:
> 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

Answering my own question: because it fails if `__has_builtin` is not
defined. I was expecting the 2nd expression wouldn't get evaluated at
all. Should probably take some time and learn more about the
pre-processor sometimes.

- NRK

Reply via email to