mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 03:50:13 +01:00
util/macros: coerce likely/unlikely to bool even without __builtin_expect
Coercing the argument to a bool when we have __builtin_expect but leaving it unmodified otherwise is a recipe for really subtle bugs. I don't know if any bugs like that exist currently, but I almost introduced one in panfrost. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37801>
This commit is contained in:
parent
196c7903b9
commit
10a8defecc
1 changed files with 2 additions and 2 deletions
|
|
@ -66,8 +66,8 @@
|
|||
# define likely(x) __builtin_expect(!!(x), 1)
|
||||
# define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
# else
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define likely(x) (!!(x))
|
||||
# define unlikely(x) (!!(x))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue