[XviD-devel] Coding tricks...

skal skal at planet-d.net
Mon Aug 18 16:55:34 CEST 2003


	Hi Christoph and all,

	a piece of advice:

On Sun, 2003-08-10 at 20:22, Christoph Lampert wrote:
> A branchless, lookup-free, alternative to code like if (a<b) x=c; else x=d; 
> is 
> 
> ((((a-b) >> (WORDBITS-1)) & (c^d)) ^ d)
> 

	i'm a big fan of such tricks, BUT they should nevertheless
	be used with care, coz:

	a) instruction count is higher
	b) more important: both 'c' and 'd' expressions
	are evaluated, no matter what. This can be a severe
	trap if hidden inside a macro...

	just MHO...

	bye!
		Skal





More information about the XviD-devel mailing list