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 2F54F45E32; Wed, 4 Dec 2024 21:10:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0268D40ED2; Wed, 4 Dec 2024 21:10:45 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 837D140E5A for ; Wed, 4 Dec 2024 21:10:41 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 9033120BCAFD; Wed, 4 Dec 2024 12:10:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9033120BCAFD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733343040; bh=bj7LMBigaTwBAguveQDqd2wTMyJK6+tUm+GmtIOBi+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8KHX/WcvuIiWuhHQq30ZG1d+jGgjxXWyJSJle8Wnw20IsEzPw1L8TJDw11GiMH1W 81J5B3iEqH88IZZ0givJ5b6nmMnuDWv9xiimvBu8NxpE/pmnaDA74kYKgGqYuvSUPj UdMSC0Q+wv2xLibfsQpC3UlPGRsoduqW4tpa8BGQ= From: Andre Muezerie To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Chaoyong He Cc: dev@dpdk.org, Andre Muezerie Subject: [PATCH 2/6] drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 12:09:51 -0800 Message-Id: <1733342995-3722-3-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733342995-3722-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-1-git-send-email-andremue@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 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 equaly well use sizeof(long) instead. Signed-off-by: Andre Muezerie --- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_bits.h b/drivers/common/cnxk/roc_bits.h index 11216d9d63..aa4944ae7f 100644 --- a/drivers/common/cnxk/roc_bits.h +++ b/drivers/common/cnxk/roc_bits.h @@ -14,10 +14,10 @@ #endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8) #endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8) #endif #ifndef GENMASK diff --git a/drivers/common/nfp/nfp_platform.h b/drivers/common/nfp/nfp_platform.h index 0b02fcf1e8..27792aca97 100644 --- a/drivers/common/nfp/nfp_platform.h +++ b/drivers/common/nfp/nfp_platform.h @@ -14,8 +14,8 @@ #define DMA_BIT_MASK(n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8) #define GENMASK(h, l) \ ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1))) -- 2.47.0.vfs.0.3