[DVDnav-discuss] VLC patches

Nico Sabbi Nicola.Sabbi at poste.it
Wed Dec 5 00:06:17 CET 2007


Il Monday 12 November 2007 23:02:01 Jean-Baptiste Kempf ha scritto:
> On Mon, Nov 12, 2007, Nico Sabbi wrote :

> > > wanted to inform you about that.
> >
> > the patch to bswap.h seems to be essentially cosmetical
>

Damien.Fouilleul at laposte.net wrote:

>well, it's not quite cosmetic, if you look at the following line
>
>      (((x) & 0x00000000000000ff) << 56))
>
>in order to type the constant, the C compiler usually uses the type 
>with the most convenient storage size that can accommodate it,
>which in this case would be an int. But it would also consider the 
>type of x, and use its type to evaluate the expression it if its 
>storage size is bigger than a int.
>therefore if you 100% sure that x would always be an int64_t, then 
>you will never have a problem, but if you use another type such as 
>in32_t, etc..
>then <<56 would overflow and cause a problem, by using 
>0x00000000000000ffLL, you force the compiler to use int64_t 
>regardless of the type of x.

I'm convinced, applied this part for the time being.
Thanks



More information about the DVDnav-discuss mailing list