[dpdk-dev,v5,14/21] rte_ip.h: cast around promotion to int
Checks
Commit Message
/projects/lagopus/src/dpdk/build/include/
rte_ip.h: In function 'rte_ipv4_cksum':
/projects/lagopus/src/dpdk/build/include/
rte_ip.h:256:35: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
return (cksum == 0xffff) ? cksum : ~cksum;
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Signed-off-by: Andy Green <andy@warmcat.com>
---
lib/librte_net/rte_ip.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -253,7 +253,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
{
uint16_t cksum;
cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
- return (cksum == 0xffff) ? cksum : ~cksum;
+ return (cksum == 0xffff) ? cksum : (uint16_t)~cksum;
}
/**