From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion Date: Sun, 13 May 2018 18:59:34 +0200 Message-ID: <10112839.slRIOooWqA@xps> References: <152609021699.121661.5295227351721865436.stgit@localhost.localdomain> <152609040775.121661.12633606299514774674.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Andy Green Return-path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id BCCC41D0C7 for ; Sun, 13 May 2018 18:59:36 +0200 (CEST) In-Reply-To: <152609040775.121661.12633606299514774674.stgit@localhost.localdomain> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 12/05/2018 04:00, Andy Green: > --- a/lib/librte_eal/common/include/generic/rte_byteorder.h > +++ b/lib/librte_eal/common/include/generic/rte_byteorder.h > @@ -123,7 +123,7 @@ typedef uint64_t rte_le64_t; /**< 64-bit little-endian value. */ > static inline uint16_t > rte_constant_bswap16(uint16_t x) > { > - return RTE_STATIC_BSWAP16(x); > + return (uint16_t)RTE_STATIC_BSWAP16((uint16_t)x); > } x is already uint16_t, and RTE_STATIC_BSWAP16 is already casting to uint16_t. So why these casts are needed? And why not in rte_constant_bswap32/64?