Re: [spice v3] utils: Remove the LL suffix from NSEC_PER_SEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
> > 
> > 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@xxxxxxxxxxxxxxx>

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]