[PATCH v2 20/36] eal: add macro for marking assumed alignment
Bruce Richardson
bruce.richardson at intel.com
Tue Jan 13 16:14:44 CET 2026
Provide a common DPDK macro for the gcc/clang builtin
__rte_assume_aligned to mark pointers as pointing to something with
known minimum alignment.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/eal/include/rte_common.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 9e7d84f929..11d6f2bee1 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -121,6 +121,12 @@ extern "C" {
#define __rte_aligned(a) __attribute__((__aligned__(a)))
#endif
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_assume_aligned(ptr, align) (ptr)
+#else
+#define __rte_assume_aligned __builtin_assume_aligned
+#endif
+
#ifdef RTE_ARCH_STRICT_ALIGN
typedef uint64_t unaligned_uint64_t __rte_aligned(1);
typedef uint32_t unaligned_uint32_t __rte_aligned(1);
--
2.51.0
More information about the dev
mailing list