mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-24 19:00:23 +08:00
nasmlib.h: add unlikely() to nasm_assert()
We explicitly want the compiler to pessimize the taken case of the assert, so unlikely() is appropriate here. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
7f2c476297
commit
fe1ca5a09f
@ -172,8 +172,11 @@ char *nasm_strndup_log(const char *, int, const char *, size_t);
|
||||
* NASM assert failure
|
||||
*/
|
||||
noreturn nasm_assert_failed(const char *, int, const char *);
|
||||
#define nasm_assert(x) \
|
||||
do { if (!(x)) nasm_assert_failed(__FILE__,__LINE__,#x); } while (0)
|
||||
#define nasm_assert(x) \
|
||||
do { \
|
||||
if (unlikely(!(x))) \
|
||||
nasm_assert_failed(__FILE__,__LINE__,#x); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* ANSI doesn't guarantee the presence of `stricmp' or
|
||||
|
Loading…
x
Reference in New Issue
Block a user