Use false instead of 0 for a boolean

This commit is contained in:
Chris Robinson 2019-03-24 14:02:06 -07:00
parent f7ab7b45f7
commit c8e8ac42ab

View File

@ -12,9 +12,9 @@
* required to be true, but it can result in more optimal code for the true * required to be true, but it can result in more optimal code for the true
* path at the expense of a less optimal false path. * path at the expense of a less optimal false path.
*/ */
#define LIKELY(x) __builtin_expect(!!(x), !0) #define LIKELY(x) __builtin_expect(!!(x), !false)
/* The opposite of LIKELY, optimizing the case where the condition is false. */ /* The opposite of LIKELY, optimizing the case where the condition is false. */
#define UNLIKELY(x) __builtin_expect(!!(x), 0) #define UNLIKELY(x) __builtin_expect(!!(x), false)
/* Unlike LIKELY, ASSUME requires the condition to be true or else it invokes /* Unlike LIKELY, ASSUME requires the condition to be true or else it invokes
* undefined behavior. It's essentially an assert without actually checking the * undefined behavior. It's essentially an assert without actually checking the
* condition at run-time, allowing for stronger optimizations than LIKELY. * condition at run-time, allowing for stronger optimizations than LIKELY.