likely.h: fix spdk_likely condition
The __builtin_expect(), as written before, would have generated the right branch taken/not taken condition, but the return value was the opposite of the cond value. We need to double-not the value to convert it to a 0/1 value while preserving its original 0/non-zero sense. Change-Id: I38101ff3ed8e89fc6516cfcdf7d642651545e4ff Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
01529c676b
commit
6854710d6d
@ -39,6 +39,6 @@
|
||||
#define SPDK_LIKELY_H
|
||||
|
||||
#define spdk_unlikely(cond) __builtin_expect((cond), 0)
|
||||
#define spdk_likely(cond) __builtin_expect(!(cond), 0)
|
||||
#define spdk_likely(cond) __builtin_expect(!!(cond), 1)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user