From: Norbert Pocs Date: Thu, 3 Jul 2025 14:21:49 +0000 (+0200) Subject: crypto/params.c optimize ossl_(un)likely X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=682f701985282be4c4ee4ce21db15bf86a44e90d;p=thirdparty%2Fopenssl.git crypto/params.c optimize ossl_(un)likely Signed-off-by: Norbert Pocs Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27961) --- diff --git a/crypto/params.c b/crypto/params.c index f3d86ca6da7..0c7dcadb099 100644 --- a/crypto/params.c +++ b/crypto/params.c @@ -16,6 +16,7 @@ #include "internal/endian.h" #include "internal/params.h" #include "internal/packet.h" +#include "internal/common.h" /* Shortcuts for raising errors that are widely used */ #define err_unsigned_negative \ @@ -52,7 +53,7 @@ static unsigned int real_shift(void) OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *p, const char *key) { - if (p != NULL && key != NULL) + if (ossl_likely(p != NULL && key != NULL)) for (; p->key != NULL; p++) if (strcmp(key, p->key) == 0) return p; @@ -868,7 +869,7 @@ int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val) return 0; } - if (p->data_type == OSSL_PARAM_UNSIGNED_INTEGER) { + if (ossl_likely(p->data_type == OSSL_PARAM_UNSIGNED_INTEGER)) { #ifndef OPENSSL_SMALL_FOOTPRINT switch (p->data_size) { case sizeof(uint32_t):