This macro removes the const attribute of a variable. It must be used with care in specific situations. It's better to use this macro instead of a manual cast, as it explicitly shows the intention of the developer.
This macro is used in the next commit of the series. Signed-off-by: Olivier Matz <olivier.matz at 6wind.com> --- lib/librte_eal/common/include/rte_common.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 332f2a4..dc0fc83 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -285,6 +285,15 @@ rte_align64pow2(uint64_t v) /*********** Other general functions / macros ********/ +/** + * Remove the const attribute of a variable + * + * This must be used with care in specific situations. It's better to + * use this macro instead of a manual cast, as it explicitly shows the + * intention of the developer. + */ +#define RTE_DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) + #ifdef __SSE2__ #include <emmintrin.h> /** -- 2.1.4