[sldev] getting serious about software.

Nicholaz Beresford nicholaz at blueflash.cc
Sat Jun 23 05:49:08 PDT 2007


> I'll give a fun example from the LL code:
> 
> This is the current code for finding the next power of two:
> F32 next_power_of_two(F32 value)
> {
>     S32 power = (S32)llceil((F32)log((double)value)/(F32)log(2.0));
>     return pow(2.0f, power);
> }

Umm, what's most amusing is that for the fun of it I rewrote
it to S32 and bit shifting (inside the function casting the
parameter from F32 to S32 and the result back to F32) just to
find later that the function is only called two times in the
following form:

	sides = (S32)next_power_of_two((F32)sides);


ROFLMAO :-)

(Not that this has any real impact on the program runtime.)


Nick


More information about the SLDev mailing list