[Bf-committers] pixelblending.c issues
Jeroen Lamain
bf-committers@blender.org
Fri, 28 Mar 2003 12:45:07 +0100
Ton Roosendaal wrote:
> Hi Jeroen,
>
> In 2000 I've transferred the render part of Blender to Njin-zu Chen, he
> rewrote quite a bit of my code. The function you mention is from him,
> maybe if he reads this mail he can elaborate it some.
>
> But I have the same doubts as you do, especially the the line
>
>> cf[0] = target[0]/target[3];
>
>
> where 'cf' is float, and 'target' is a char. It looks like a compiler
> will convert the right hand of the equation to float first, but it
> wouldn't be something I would count on for all compilers!
Hi Ton,
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). 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).
Thanks for the explanation of the algorithm, I will look further into it this
weekend.
Greetz,
Jeroen
--------------------------------------------------------------
Jeroen Lamain, Oce Technologies B.V. Research and Development
tel: +31 (0)77 359 4922 fax: +31 (0)77 359 5473