eal: explicit cast in constant byte swap
authorAndy Green <andy@warmcat.com>
Thu, 17 May 2018 13:50:37 +0000 (21:50 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 20 May 2018 22:20:05 +0000 (00:20 +0200)
commitc7bf8093820b0d740e15f166c3fceb1edb2b2a83
tree85e255ed4dd63fe6b4b37755fafffebca5197dfc
parentd3db77d7d88e1f9227c2847f3355fc3e4bd256e8
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: b75667ef9f7e ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
lib/librte_eal/common/include/generic/rte_byteorder.h