[DVDnav-discuss] VLC patches

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Nov 30 10:25:14 CET 2007


On Fri, Nov 30, 2007 at 12:13:42AM +0000, Damien Fouilleul 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.

Isn't that what typecasts are there for, or is obfuscation the primary
goal?



More information about the DVDnav-discuss mailing list