[PATCH v2 1/2] lib/hash: initialize __m128i data type in a portable way

Bruce Richardson bruce.richardson at intel.com
Wed Mar 5 10:13:07 CET 2025


On Tue, Mar 04, 2025 at 01:53:18PM -0800, Andre Muezerie wrote:
> The mechanism used to initialize an __m128i data type in rte_thash.h is
> non-portable and MSVC does not like it. It clearly is not doing what
> is desired:
> 
> ..\lib\hash\rte_thash.h(38): warning C4305: 'initializing':
>     truncation from 'unsigned __int64' to 'char'
> ..\lib\hash\rte_thash.h(38): warning C4305: 'initializing':
>     truncation from 'unsigned __int64' to 'char'
> 
> A more portable approach is to use compiler intrinsics to perform the
> initialization. This patch uses a single compiler intrinsic to
> initialize the data.
> 
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---
>  lib/hash/rte_thash.h | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
Much simpler fix, thanks.

Acked-by: Bruce Richardson <bruce.richardson at intel.com>


More information about the dev mailing list