From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDA2943D0A; Wed, 20 Mar 2024 22:33:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E31442E52; Wed, 20 Mar 2024 22:33:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4842342DF0 for ; Wed, 20 Mar 2024 22:33:40 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 926DC20B74C2; Wed, 20 Mar 2024 14:33:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 926DC20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710970419; bh=Xgnxw5kbPdpr/6stM/xRxTFlKKcRaOPYkWsLcHCrk/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNXgTlNApC24evIHmtCjeTY+JHoUisCItD27zZnnhkct8GiAUoJtH4y7/OsAIgI6n FT812OTw1fHoTAOV8O/F7aTdT21k2Nwyp2m6J1POP/SnhOgCmRSm0EF6p84pHDMv3q H8l4tLssB/8/L+bfsLwvCA6rjMUvDJAM7+SkP8Q0= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , Andrew Rybchenko , Tyler Retzlaff Subject: [PATCH 2/2] mempool: use rte constant macro instead of GCC builtin Date: Wed, 20 Mar 2024 14:33:36 -0700 Message-Id: <1710970416-27841-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710970416-27841-1-git-send-email-roretzla@linux.microsoft.com> References: <1710970416-27841-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use newly introduced __rte_constant(e) macro instead of directly using __builtin_constant_p() allowing mempool to be built by MSVC. Signed-off-by: Tyler Retzlaff --- lib/mempool/rte_mempool.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 23fd5c8..a3564fb 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -1521,7 +1521,7 @@ struct rte_mempool_cache * /* The cache is a stack, so copy will be in reverse order. */ cache_objs = &cache->objs[cache->len]; - if (__extension__(__builtin_constant_p(n)) && n <= cache->len) { + if (__rte_constant(n) && n <= cache->len) { /* * The request size is known at build time, and * the entire request can be satisfied from the cache, @@ -1542,8 +1542,7 @@ struct rte_mempool_cache * * If the request size 'n' is known at build time, the above comparison * ensures that n > cache->len here, so omit RTE_MIN(). */ - len = __extension__(__builtin_constant_p(n)) ? cache->len : - RTE_MIN(n, cache->len); + len = __rte_constant(n) ? cache->len : RTE_MIN(n, cache->len); cache->len -= len; remaining = n - len; for (index = 0; index < len; index++) @@ -1554,7 +1553,7 @@ struct rte_mempool_cache * * where the entire request can be satisfied from the cache * has already been handled above, so omit handling it here. */ - if (!__extension__(__builtin_constant_p(n)) && remaining == 0) { + if (!__rte_constant(n) && remaining == 0) { /* The entire request is satisfied from the cache. */ RTE_MEMPOOL_CACHE_STAT_ADD(cache, get_success_bulk, 1); -- 1.8.3.1