Commit 6854710d authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 01529c67
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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