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 BD2BE45E32;
	Wed,  4 Dec 2024 21:10:48 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id B5CA240ECF;
	Wed,  4 Dec 2024 21:10:43 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 75EEE40E54
 for <dev@dpdk.org>; Wed,  4 Dec 2024 21:10:41 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1213)
 id B52B620BCAFE; Wed,  4 Dec 2024 12:10:40 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B52B620BCAFE
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1733343040;
 bh=VNPPkLI/ddKW5ptby6VfGZMT9CL1Q5U4nVjVLSu2Ty8=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=KE4dZgeCmhRYKe0y8LBBVjxSXG6BL5GIfGJ4a1wp9jpBIc8A+SN85X2XeHQ+RCrTK
 U73NlKwq3NRj7VtbqCsCnyrJQDxi/NVaLlm7XQEtrrQv1xTi3Jo5GdBBK05p6UH50Z
 aY7Igo9GlKBC82K4mornQnPGrw2TNeLO3mfeUXvg=
From: Andre Muezerie <andremue@linux.microsoft.com>
To: Gagandeep Singh <g.singh@nxp.com>, Sachin Saxena <sachin.saxena@nxp.com>,
 Chengwen Feng <fengchengwen@huawei.com>
Cc: dev@dpdk.org,
	Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH 3/6] drivers/dma: eliminate dependency on non-portable
 __SIZEOF_LONG__
Date: Wed,  4 Dec 2024 12:09:52 -0800
Message-Id: <1733342995-3722-4-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 <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 equaly well use sizeof(long) instead.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/dma/dpaa/dpaa_qdma.h        | 2 +-
 drivers/dma/hisilicon/hisi_dmadev.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h
index 579483ac34..3736c0d431 100644
--- a/drivers/dma/dpaa/dpaa_qdma.h
+++ b/drivers/dma/dpaa/dpaa_qdma.h
@@ -14,7 +14,7 @@
 #define RETRIES	5
 
 #ifndef GENMASK
-#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))))
 #endif
diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h
index 786fe3cc0e..777b9dd704 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.h
+++ b/drivers/dma/hisilicon/hisi_dmadev.h
@@ -12,7 +12,7 @@
 #include <rte_dmadev_pmd.h>
 
 #define BIT(x)	(1ul << (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))))
 #define BF_SHF(x) rte_bsf64(x)
-- 
2.47.0.vfs.0.3