[v3,1/7] lib/eal: 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>
---
lib/eal/include/rte_common.h | 5 +++++
1 file changed, 5 insertions(+)
@@ -603,6 +603,11 @@ rte_is_aligned(const void * const __rte_restrict ptr, const unsigned int align)
*/
#define RTE_BUILD_BUG_ON(condition) do { static_assert(!(condition), #condition); } while (0)
+/*********** Data type size related macros ********/
+
+#define RTE_BITS_PER_LONG (sizeof(long) * 8)
+#define RTE_BITS_PER_LONG_LONG (sizeof(long long) * 8)
+
/*********** Cache line related macros ********/
/** Cache line mask. */