mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Don't use clang's __builtin_assume as an optimizer hint (#608)
Fixes #607. Drive-by: use '?:' to contextually convert to bool in the fallback definition of `GSL_ASSUME`
This commit is contained in:
parent
c23d17a61a
commit
95da2fd337
@ -52,12 +52,10 @@
|
|||||||
//
|
//
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define GSL_ASSUME(cond) __assume(cond)
|
#define GSL_ASSUME(cond) __assume(cond)
|
||||||
#elif defined(__clang__)
|
|
||||||
#define GSL_ASSUME(cond) __builtin_assume(cond)
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define GSL_ASSUME(cond) ((cond) ? static_cast<void>(0) : __builtin_unreachable())
|
#define GSL_ASSUME(cond) ((cond) ? static_cast<void>(0) : __builtin_unreachable())
|
||||||
#else
|
#else
|
||||||
#define GSL_ASSUME(cond) static_cast<void>(!!(cond))
|
#define GSL_ASSUME(cond) static_cast<void>((cond) ? 0 : 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user