[v2,14/14] eal: redefine macro to be integer literal for MSVC

Message ID 1707884270-27189-15-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Series use C11 alignas and normalize type alignment |


Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build fail github build: failed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Tyler Retzlaff Feb. 14, 2024, 4:17 a.m. UTC
  MSVC __declspec(align(#)) is limited and accepts only integer literals
as opposed to constant expressions. define XMM_SIZE to be 16 instead of
sizeof(xmm_t) and static_assert that sizeof(xmm_t) == 16 for

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
 lib/eal/x86/include/rte_vect.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


diff --git a/lib/eal/x86/include/rte_vect.h b/lib/eal/x86/include/rte_vect.h
index a1a537e..441f1a0 100644
--- a/lib/eal/x86/include/rte_vect.h
+++ b/lib/eal/x86/include/rte_vect.h
@@ -11,6 +11,7 @@ 
  * RTE SSE/AVX related header.
+#include <assert.h>
 #include <stdint.h>
 #include <rte_config.h>
 #include <rte_common.h>
@@ -33,9 +34,11 @@ 
 typedef __m128i xmm_t;
-#define	XMM_SIZE	(sizeof(xmm_t))
+#define	XMM_SIZE	16
 #define	XMM_MASK	(XMM_SIZE - 1)
+static_assert(sizeof(xmm_t) == 16, "");
 typedef union rte_xmm {
 	xmm_t    x;
 	uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];