diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-11-18 14:15:44 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2020-11-18 14:15:44 -0800 |
commit | a081a013f3749f126c3c22a6dc9919314b61685d (patch) | |
tree | 59dce4439798f8aefa3b3798eac29b405e2e5f4c | |
parent | a4994cba0d26915f46292a9ac7c4ce80094c4755 (diff) | |
download | riscv-isa-sim-a081a013f3749f126c3c22a6dc9919314b61685d.zip riscv-isa-sim-a081a013f3749f126c3c22a6dc9919314b61685d.tar.gz riscv-isa-sim-a081a013f3749f126c3c22a6dc9919314b61685d.tar.bz2 |
Only use __builtin_expect for __GNUC__
-rw-r--r-- | riscv/common.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/riscv/common.h b/riscv/common.h index 3c523d0..d593df2 100644 --- a/riscv/common.h +++ b/riscv/common.h @@ -3,8 +3,13 @@ #ifndef _RISCV_COMMON_H #define _RISCV_COMMON_H -#define likely(x) __builtin_expect(x, 1) -#define unlikely(x) __builtin_expect(x, 0) +#ifdef __GNUC__ +# define likely(x) __builtin_expect(x, 1) +# define unlikely(x) __builtin_expect(x, 0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif #define NOINLINE __attribute__ ((noinline)) |