include: add branch prediction for assert

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-02-23 16:11:17 +08:00 committed by Xiang Xiao
parent ecdaeddfcd
commit cb594a4c9c
1 changed files with 4 additions and 4 deletions

View File

@ -50,11 +50,11 @@
#define PANIC() __assert(__FILE__, __LINE__, "panic")
#ifdef CONFIG_DEBUG_ASSERTIONS_EXPRESSION
#define ASSERT(f) do { if (!(f)) __assert(__FILE__, __LINE__, #f); } while (0)
#define VERIFY(f) do { if ((f) < 0) __assert(__FILE__, __LINE__, #f); } while (0)
#define ASSERT(f) do { if (unlikely(!(f))) __assert(__FILE__, __LINE__, #f); } while (0)
#define VERIFY(f) do { if (unlikely((f) < 0)) __assert(__FILE__, __LINE__, #f); } while (0)
#else
#define ASSERT(f) do { if (!(f)) __assert(__FILE__, __LINE__, NULL); } while (0)
#define VERIFY(f) do { if ((f) < 0) __assert(__FILE__, __LINE__, NULL); } while (0)
#define ASSERT(f) do { if (unlikely(!(f))) __assert(__FILE__, __LINE__, NULL); } while (0)
#define VERIFY(f) do { if (unlikely((f) < 0)) __assert(__FILE__, __LINE__, NULL); } while (0)
#endif
#ifdef CONFIG_DEBUG_ASSERTIONS