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 9826B45DE4; Fri, 6 Dec 2024 17:19:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7009B4064F; Fri, 6 Dec 2024 17:19:27 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4E0E94027D for ; Fri, 6 Dec 2024 17:19:25 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 8088D20BCAEA; Fri, 6 Dec 2024 08:19:24 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8088D20BCAEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733501964; bh=IvWzh3TgpMiJJdo4bamNF6cDiRkavpvzU+94Eih+OeI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MHZugqMiuHrkzXNpOIRUFGm41pSqKMOReNx+UZampM67xVFpukCy27HMrKKONqYYh CySKMYmUndMtRIARpWQukKygvhBvlYkDpieLitISQYn7oDl59unpe4exkFdWaOv6iU o2kbAbeEm87YMHiXHxNrxPCPKpKlbhnx/kocdqXs= Date: Fri, 6 Dec 2024 08:19:24 -0800 From: Andre Muezerie To: Konstantin Ananyev Cc: "dev@dpdk.org" Subject: Re: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ Message-ID: <20241206161924.GA26543@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-3-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Dec 06, 2024 at 12:22:42PM +0000, Konstantin Ananyev wrote: > > > > > > Macro __SIZEOF_LONG__ is not standardized and MSVC does not define it. > > Therefore the errors below are seen with MSVC: > > > > ../lib/mldev/mldev_utils_scalar.c(465): error C2065: > > '__SIZEOF_LONG__': undeclared identifier > > ../lib/mldev/mldev_utils_scalar.c(478): error C2051: > > case expression not constant > > > > ../lib/mldev/mldev_utils_scalar_bfloat16.c(33): error C2065: > > '__SIZEOF_LONG__': undeclared identifier > > ../lib/mldev/mldev_utils_scalar_bfloat16.c(49): error C2051: > > case expression not constant > > > > Turns out that the places where __SIZEOF_LONG__ is currently > > being used can equally well use sizeof(long) instead. > > > > Signed-off-by: Andre Muezerie > > --- > > drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/bus/fslmc/mc/fsl_mc_cmd.h b/drivers/bus/fslmc/mc/fsl_mc_cmd.h > > index a768774c89..f27a18905d 100644 > > --- a/drivers/bus/fslmc/mc/fsl_mc_cmd.h > > +++ b/drivers/bus/fslmc/mc/fsl_mc_cmd.h > > @@ -29,9 +29,8 @@ > > #define le32_to_cpu rte_le_to_cpu_32 > > #define le16_to_cpu rte_le_to_cpu_16 > > > > -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) > > #define GENMASK(h, l) \ > > - (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) > > + (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h)))) > > Inside > There are macros: RTE_GENMASK64 (and RTE_GENMASK32). > Which as I understand does same thing. > Might be better to just use these ones instead of hand-crafting > same thing over different PMDs. > I agree. I can submit a separate patch for that once this series aimed at unblocking MSVC from being used on this code goes in, if that is OK. If instead you feel strongly that this change should be made as part of this series let me know. -- Andre Muezerie > > > > struct mc_cmd_header { > > union { > > -- > > 2.47.0.vfs.0.3