[dpdk-dev] [PATCH v3 17/24] rte_byteorder.h: explicit cast for return promotion
Thomas Monjalon
thomas at monjalon.net
Sun May 13 18:59:34 CEST 2018
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?
More information about the dev
mailing list