At 1/9/11 02:06 PM, Chickumbleh wrote: I found this substitute for Math.floor() in the haXe community. I know just setting a Number to an int works faster than Math.floor. This seems really large to be fast.
I tested that against my one-liner:
static inline function myFloor(f:Float){
return f > 0 ? Std.int(f) : Std.int(f)-1;
}
Both compiled with hAxe: mine ran 6x faster. (10 million loop with +/- pi)
#include <stdio.h>
char*p="#include <stdio.h>%cchar*p=%c%s%c;%cmain() {printf(p,10,34,p,34,10);}";
main() {printf(p,10,34,p,34,10);}