[XviD-devel] gmc weirdo

Christoph Lampert chl at math.uni-bonn.de
Sat Aug 9 17:15:22 CEST 2003


On Sat, 9 Aug 2003, Radek Czyz wrote:
> > if ((uint32_t)u<=(uint32_t)W)
> > and
> > if ((uint32_t)v<=(uint32_t)H)
> 
> That's the thing. Optimizations make the code working as if uint32
> casting wasn't there, which makes the third option (else Offset = -1;)
> impossible. 

You can forget cast of W and H, that's just to shut up the compiler.
The cast of u and v is a trick to do the check: 

if ( (u<0) || (u>=W) ) 

in one step. If u is negativ, (uint32_t)u is extremely large, 
so the check against W is true. 

I don't remember what (uint32_t) of a negative int is supposed to be 
following the C standard. I'll check... 

Until we find out if this is a compiler bug, just replace the 
single check by the usual two checks. 

gruel







More information about the XviD-devel mailing list