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 <andre...@linux.microsoft.com>
---
 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

Reply via email to