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 9348945FD9; Fri, 3 Jan 2025 21:38:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51B1B402DC; Fri, 3 Jan 2025 21:38:47 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C07F9402B1 for ; Fri, 3 Jan 2025 21:38:45 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id B93B82041AAA; Fri, 3 Jan 2025 12:38:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B93B82041AAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1735936724; bh=qgMgomDGAt1nRebac6P0dBFIHR8dALli2UdAWX2IHoA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KRQ06zghK7IbK9SzdFzcLfh9gsHvcXrnKgR+ixrdVpQFSdCycBUBkKISNzZKn9AjI GrltDbvvKknqkS6su1+p01pBz9a7vUCDWDl+e/5mCInHk0laWss3iPKz45LmsyBVDT ggaBxGNPk9zCIHwXK+SGlNGhATRV+HbIvF6zRUeA= Date: Fri, 3 Jan 2025 12:38:44 -0800 From: Andre Muezerie To: Morten =?iso-8859-1?Q?Br=F8rup?= Cc: Tyler Retzlaff , dev@dpdk.org Subject: Re: [PATCH 2/5] lib/eal: add portable version of __builtin_add_overflow Message-ID: <20250103203844.GA23771@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1735857169-19131-1-git-send-email-andremue@linux.microsoft.com> <1735857169-19131-3-git-send-email-andremue@linux.microsoft.com> <98CBD80474FA8B44BF855DF32C47DC35E9F98D@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F98D@smartserver.smartshare.dk> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Fri, Jan 03, 2025 at 09:19:42AM +0100, Morten Brørup wrote: > > From: Andre Muezerie [mailto:andremue@linux.microsoft.com] > > Sent: Thursday, 2 January 2025 23.33 > > > > __builtin_add_overflow is gcc specific. There's a need for a portable > > version that can also be used with other compilers. > > > > 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_bitops.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". These are great suggestions. I'll incorporate them in the v2 of this series.