[dpdk-dev] [PATCH v3 06/24] /lib/librte_eal: stage cast from uint64 to long

Thomas Monjalon thomas at monjalon.net
Sun May 13 18:24:03 CEST 2018


12/05/2018 03:59, Andy Green:
> warning: conversion to 'uint64_t' {aka 'long unsigned int'}
> from 'long int' may change the sign of the result
> [-Wsign-conversion]
>   val = lrand48();
>         ^~~~~~~
[...]
>  rte_rand(void)
>  {
>  	uint64_t val;
> -	val = lrand48();
> +	val = (unsigned long)lrand48();

I think the right cast is uint64_t.
It makes a difference in 32-bit environment.





More information about the dev mailing list