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 9C78745FD2; Fri, 3 Jan 2025 09:19:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DE5140278; Fri, 3 Jan 2025 09:19:47 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 35AE24021E for ; Fri, 3 Jan 2025 09:19:45 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id C2FDE2027D; Fri, 3 Jan 2025 09:19:44 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH 2/5] lib/eal: add portable version of __builtin_add_overflow Date: Fri, 3 Jan 2025 09:19:42 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F98D@smartserver.smartshare.dk> In-Reply-To: <1735857169-19131-3-git-send-email-andremue@linux.microsoft.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH 2/5] lib/eal: add portable version of __builtin_add_overflow Thread-Index: AdtdZk178FRiJI9KTh6rdPEkZWDKMAATuaLw References: <1735857169-19131-1-git-send-email-andremue@linux.microsoft.com> <1735857169-19131-3-git-send-email-andremue@linux.microsoft.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Andre Muezerie" , "Tyler Retzlaff" Cc: 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 > From: Andre Muezerie [mailto:andremue@linux.microsoft.com] > Sent: Thursday, 2 January 2025 23.33 >=20 > __builtin_add_overflow is gcc specific. There's a need for a portable > version that can also be used with other compilers. >=20 > This patch introduces __rte_add_overflow_u8, __rte_add_overflow_u16 > and __rte_add_overflow_u32. Instead of the proposed three type-specific macros, add one generic = rte_add_overflow(a, b, res) macro, like rte_bit_test() [1] using = "_Generic". [1]: = https://elixir.bootlin.com/dpdk/v24.11.1/source/lib/eal/include/rte_bitop= s.h#L130 You may still need the type-specific macros as internal helpers for the = MSVC implementation. Furthermore, a 64 bit variant might be useful. PS: DPDK naming convention typically uses just "8"/"16"/"32" postfix to = the function name, not "_u8"/"_u16"/"_u32".