From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DC57045E33;
	Wed,  4 Dec 2024 22:41:22 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C6C4340EAB;
	Wed,  4 Dec 2024 22:41:14 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 4C116402AF
 for <dev@dpdk.org>; Wed,  4 Dec 2024 22:41:10 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1213)
 id 8C5A820CECB1; Wed,  4 Dec 2024 13:41:09 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C5A820CECB1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1733348469;
 bh=0jAs6eeXKL17K+bCnDlmro/2JXDUt/1p2+5YrRDKSMI=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=dQqM72C76BUAHJAkWqIfPycl4cSOPqmgJ5QGrfmgEA5bUu12P971HykLwLRfin4rz
 goToIjWBexAnygwPSa+DmHU0fKdQYlJKcIJXZiRf6S8NGTz+U86QM9vgbSnJZCduGU
 EWHpPjiPZlI1H6gAd0UlQWGuYbnKM3/vRklnLoNw=
From: Andre Muezerie <andremue@linux.microsoft.com>
To: dev@dpdk.org
Cc: Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH v2 4/6] drivers/net: eliminate dependency on non-portable
 __SIZEOF_LONG__
Date: Wed,  4 Dec 2024 13:41:04 -0800
Message-Id: <1733348466-16057-5-git-send-email-andremue@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1733348466-16057-1-git-send-email-andremue@linux.microsoft.com>
References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com>
 <1733348466-16057-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=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 equally well use sizeof(long) instead.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 4 ++--
 drivers/net/hns3/hns3_ethdev.h       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 1121460470..24e0435ac1 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -97,11 +97,11 @@ extern int ena_logtype_com;
 #define ENA_MIN16(x, y) ENA_MIN_T(uint16_t, (x), (y))
 #define ENA_MIN8(x, y) ENA_MIN_T(uint8_t, (x), (y))
 
-#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)
+#define BITS_PER_LONG_LONG (sizeof(long long) * 8)
 #define U64_C(x) x ## ULL
 #define BIT(nr)	RTE_BIT32(nr)
 #define BIT64(nr)	RTE_BIT64(nr)
-#define BITS_PER_LONG	(__SIZEOF_LONG__ * 8)
+#define BITS_PER_LONG	(sizeof(long) * 8)
 #define GENMASK(h, l)	(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
 #define GENMASK_ULL(h, l) (((~0ULL) - (1ULL << (l)) + 1) &		       \
 			  (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 7824503bb8..207a92f832 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -952,7 +952,7 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)
 
 #define BIT_ULL(x) (1ULL << (x))
 
-#define BITS_PER_LONG	(__SIZEOF_LONG__ * 8)
+#define BITS_PER_LONG	(sizeof(long) * 8)
 #define GENMASK(h, l) \
 	(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
 
-- 
2.47.0.vfs.0.3