From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 582851B862 for ; Thu, 10 May 2018 04:48:39 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Thu, 10 May 2018 10:48:35 +0800 Message-ID: <152592051501.119328.1625476164753142468.stgit@localhost.localdomain> In-Reply-To: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> References: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v3 27/40] rte_mbuf.h: explicit casts for flipping between int16_t and uint16_t X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 02:48:39 -0000 differences to the atomic16 are signed, but the atomic16 itself is unsigned. It needs to be made explicit with casts. Signed-off-by: Andy Green --- lib/librte_mbuf/rte_mbuf.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index a2a37a311..c214f1945 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -806,7 +806,7 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m) static inline void rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) { - rte_atomic16_set(&m->refcnt_atomic, new_value); + rte_atomic16_set(&m->refcnt_atomic, (int16_t)new_value); } /* internal */ @@ -837,8 +837,8 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) */ if (likely(rte_mbuf_refcnt_read(m) == 1)) { ++value; - rte_mbuf_refcnt_set(m, value); - return value; + rte_mbuf_refcnt_set(m, (uint16_t)value); + return (uint16_t)value; } return __rte_mbuf_refcnt_update(m, value); @@ -909,7 +909,7 @@ static inline void rte_mbuf_ext_refcnt_set(struct rte_mbuf_ext_shared_info *shinfo, uint16_t new_value) { - rte_atomic16_set(&shinfo->refcnt_atomic, new_value); + rte_atomic16_set(&shinfo->refcnt_atomic, (int16_t)new_value); } /** @@ -929,8 +929,8 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo, { if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) { ++value; - rte_mbuf_ext_refcnt_set(shinfo, value); - return value; + rte_mbuf_ext_refcnt_set(shinfo, (uint16_t)value); + return (uint16_t)value; } return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);