[v3,6/7] drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
Checks
Commit Message
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/raw/ifpga/base/opae_osdep.h | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
@@ -9,6 +9,8 @@
#include <stdbool.h>
#include <pthread.h>
+#include <rte_common.h>
+
#ifdef RTE_LIB_EAL
#include "osdep_rte/osdep_generic.h"
#else
@@ -30,12 +32,6 @@ struct uuid {
};
#ifndef LINUX_MACROS
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
-#endif
-#ifndef BITS_PER_LONG_LONG
-#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)
-#endif
#ifndef BIT
#define BIT(a) (1UL << (a))
#endif /* BIT */
@@ -43,11 +39,11 @@ struct uuid {
#define BIT_ULL(a) (1ULL << (a))
#endif /* BIT_ULL */
#ifndef GENMASK
-#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))))
#endif /* GENMASK */
#ifndef GENMASK_ULL
#define GENMASK_ULL(h, l) \
- (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+ (((~0ULL) << (l)) & (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h))))
#endif /* GENMASK_ULL */
#endif /* LINUX_MACROS */