Jump to content
Posted 18 May 2011 - 07:40 AM
Posted 18 May 2011 - 08:07 AM
bool conditionA = myFloat >= 12.0f; bool conditionB = myFloat < 24.0f; bool conditionC = conditionA && conditionB; float answer = conditionC ? foo : bar;You might use:
float conditionA = fstep(12.0f, myFloat);//same as (myFloat>=12.0f ? 1.0f : 0.0f) float conditionB = fstep(myFloat, 24.0f);//same as (myFloat<24.0f ? 1.0f : 0.0f) float conditionC = conditionA * conditionB; float answer = fselect(conditionC-1, bar, foo);//same as (conditionC>=1.0f ? foo : bar)But if the data your working with was integer data (e.g. myInt as input, and int answer as output) then you'd write it as you normally would. This is just to avoid the PPC's costly float/int conversions.
Posted 18 May 2011 - 09:23 AM