From mboxrd@z Thu Jan 1 00:00:00 1970 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) From: Olivier Matz To: dev@dpdk.org Date: Wed, 9 Mar 2016 17:19:16 +0100 Message-Id: <1457540381-20274-11-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC 10/35] eal: introduce RTE_DECONST macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2016 16:22:15 -0000 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