fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/27047 )
Change subject: core/utils.h: make use of OSMO_LIKELY in OSMO_ASSERT ......................................................................
core/utils.h: make use of OSMO_LIKELY in OSMO_ASSERT
Theoretically, this should improve performance of the code where we frequently invoke OSMO_ASSERT(), like osmo-msc and osmo-bsc.
Change-Id: I29b32a2477ec92762f8f0ce5e5c5a30810f6abbe --- M include/osmocom/core/utils.h 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 182da08..ba2cafb 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -112,7 +112,7 @@ */ #define OSMO_ASSERT(exp) \ do { \ - if (!(exp)) { \ + if (OSMO_UNLIKELY(!(exp))) { \ osmo_panic("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ } \ } while (0); /* some code invokes OSMO_ASSERT() without the semicolon */