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 EEC3945E36; Thu, 5 Dec 2024 05:21:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C99B4279E; Thu, 5 Dec 2024 05:20:45 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3D3DC402AE for ; Thu, 5 Dec 2024 05:20:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id D77EC20ACD67; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D77EC20ACD67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=x5CYD+w0ybQBfSTzQ+oFyQ9fTL4MkbrPFavjapLOT/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qj9Uy95/ITZV2Un1D7R7IntqAZz+sgfXfGACMeFvv/GlN+dwLmGicCEglgDkdRt6j sFin1T+jX0OO/qDESNBQPQED2wr0pdM8HsAZcXOJl3H6nqEYeus9bkl7+6FOMtR49o 23j5cLh+XVpdox4FK/urmxNccCnfuGplpGYMb078= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 5/7] drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:27 -0800 Message-Id: <1733372429-3996-6-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 equally well use sizeof(long) instead. Signed-off-by: Andre Muezerie --- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 1121460470..63f6ef70ee 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -97,14 +97,12 @@ 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 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 GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h)))) #define GENMASK_ULL(h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h)))) #define ena_trc_log(dev, level, fmt, arg...) \ ( \ diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 7824503bb8..c7ad9a61c7 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -952,9 +952,8 @@ 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 GENMASK(h, l) \ - (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) + (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h)))) #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #define rounddown(x, y) ((x) - ((x) % (y))) -- 2.47.0.vfs.0.3