[Spice-devel] [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

Francois Gouget fgouget at codeweavers.com
Tue Jun 25 04:38:11 UTC 2019


On Mon, 17 Jun 2019, Uri Lublin wrote:

> On 6/15/19 2:59 PM, Frediano Ziglio wrote:
> >>
> >> This constant fits in a 32 bit signed integer so it does not need the
> >> suffix. However some of the derived constants don't so use an uint64_t
> >> cast to avoid the long vs long long confusion (such as in print
> >> statements).
> >> Also some of the expressions these constants are used in may overflow so
> >> perform the appropriate casts in those locations. This makes it clearer
> >> that these operations are 64 bit.
> >>
> >> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> > 
> > ack for me, waiting Uri to confirm
> 
> Honestly, I do not see the value of making NSEC_PER_SEC a 32bit integer.
> Most of its usage is in 64bit expressions.

It's not a 32 bit vs. 64 bit issue. It's a long vs. long long one.

Whenever NSEC_PER_MILLISEC or NSEC_PER_SEC are used in a spice_debug() 
parameter one cannot use %u or %lu as the format. But not so for 
NSEC_PER_MICROSEC or MSEC_PER_SEC. This is inconsistent so that timing 
traces require lots of guessing and recompilations.


-- 
Francois Gouget <fgouget at codeweavers.com>



More information about the Spice-devel mailing list