From c981825388f81fb191f5a79c80adf0fdb074e584 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 12 May 2018 10:00:37 +0800 Subject: [PATCH] hash: explicit casts for truncation in CRC32c In function 'crc32c_sse42_u64_mimic': rte_hash_crc.h:402:40: warning: conversion from 'uint64_t' {aka 'long unsigned int'} to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion] init_val = crc32c_sse42_u32(d.u32[0], init_val); Fixes: 00bf774bab0b ("hash: add assembly implementation of CRC32 intrinsics") Cc: stable@dpdk.org Signed-off-by: Andy Green Reviewed-by: Stephen Hemminger --- lib/librte_hash/rte_hash_crc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h index 5f5fb3db18..cf28031b33 100644 --- a/lib/librte_hash/rte_hash_crc.h +++ b/lib/librte_hash/rte_hash_crc.h @@ -398,9 +398,9 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val) } d; d.u64 = data; - init_val = crc32c_sse42_u32(d.u32[0], init_val); - init_val = crc32c_sse42_u32(d.u32[1], init_val); - return init_val; + init_val = crc32c_sse42_u32(d.u32[0], (uint32_t)init_val); + init_val = crc32c_sse42_u32(d.u32[1], (uint32_t)init_val); + return (uint32_t)init_val; } #endif @@ -412,7 +412,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val) "crc32q %[data], %[init_val];" : [init_val] "+r" (init_val) : [data] "rm" (data)); - return init_val; + return (uint32_t)init_val; } #endif -- 2.20.1