From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: [RFC 10/35] eal: introduce RTE_DECONST macro Date: Wed, 9 Mar 2016 17:19:16 +0100 Message-ID: <1457540381-20274-11-git-send-email-olivier.matz@6wind.com> References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> To: dev@dpdk.org Return-path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id C7574475D for ; Wed, 9 Mar 2016 17:22:14 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id C0CAA23F82 for ; Wed, 9 Mar 2016 17:21:31 +0100 (CET) In-Reply-To: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 /** -- 2.1.4