[PATCH v3 20/36] eal: add macro for marking assumed alignment

Bruce Richardson
2026-01-30T11:44:34Z

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@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 573bf4f2ce..51a2eaf8b4 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