eal: explicit cast in constant byte swap
GCC 8.1 warns:
rte_byteorder.h: In function 'rte_constant_bswap16':
rte_byteorder.h:54:45: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
((((uint16_t)(v) & UINT16_C(0x00ff)) << 8) | \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
(((uint16_t)(v) & UINT16_C(0xff00)) >> 8))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rte_byteorder.h:126:9: note: in expansion of macro
'RTE_STATIC_BSWAP16'
return RTE_STATIC_BSWAP16(x);
^~~~~~~~~~~~~~~~~~
The other two sizes are going to be afflicted the
same, so get the same fix.
Fixes: b75667ef9f
("eal: add static endianness conversion macros")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
d3db77d7d8
commit
c7bf809382
@ -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(x);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -135,7 +135,7 @@ rte_constant_bswap16(uint16_t x)
|
||||
static inline uint32_t
|
||||
rte_constant_bswap32(uint32_t x)
|
||||
{
|
||||
return RTE_STATIC_BSWAP32(x);
|
||||
return (uint32_t)RTE_STATIC_BSWAP32(x);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -147,7 +147,7 @@ rte_constant_bswap32(uint32_t x)
|
||||
static inline uint64_t
|
||||
rte_constant_bswap64(uint64_t x)
|
||||
{
|
||||
return RTE_STATIC_BSWAP64(x);
|
||||
return (uint64_t)RTE_STATIC_BSWAP64(x);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user