[Bf-committers] pixelblending.c issues

Hans Lambermont bf-committers@blender.org
Fri, 28 Mar 2003 21:37:57 +0100


Jeroen Lamain wrote:

>>>    cf[0] = target[0]/target[3];
> 
> The compiler will definately not convert to float. That is not
> according to c-spec. Target [0] and target [1] are both chars, so the
> calculation will be done on chars. Later on the char result is
> converted to float (in the assignment).

/me agrees. *All* c-compilers should do it this way.

> It would be different if for example target[1] was a float. Then the
> the calculation would be done in the most complex type used in the
> calculation (i.e. float).

/me agrees again :)

If a quick fix is wanted I prefer to 'multiply target[0] with 1.0'
instead of a cast. But that's more a matter of taste ...

Hans
-- 
http://lambermont.webhop.org/   () ascii ribbon campaign - against HTML mail,
                                /\ vCards and proprietary formats