]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_eal/common/include/rte_common.h
ethdev: add iterator to match devargs input
[dpdk.git] / lib / librte_eal / common / include / rte_common.h
index c009a80a4730126ff2dbfdc3c8acb123ce24fe88..cba7bbc1da79c60b71a2b2ea99063798d61beef4 100644 (file)
@@ -169,6 +169,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
  */
 #define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) - (uintptr_t)(ptr2))
 
+/**
+ * Workaround to cast a const field of a structure to non-const type.
+ */
+#define RTE_CAST_FIELD(var, field, type) \
+       (*(type *)((uintptr_t)(var) + offsetof(typeof(*(var)), field)))
+
 /*********** Macros/static functions for doing alignment ********/