KARKI JITENDRA BAHADUR wrote: > > pfrants@cs.vu.nl (Frants P) writes: > > >Hi, > > >I am writing a 3d-engine with Watcom C/C++ and it produces *horrible* > >code for casting a float to int when compared with gcc. The program now > >spends more than 80% (!!!) of it's time casting float's to int and it Try something like this in C, or translate it to an inline assembly macro. As far as I know, this was originally thought out and posted by Terje Mathisen on comp.lang.asm.x86. Works like a miracle for your fp to int conversion performance. inline long float2long(float d) { #define MAGIC (((65536.0 * 65536.0 * 16.0) + 32768.0) * 65536.0) double dtemp = d + MAGIC; return (*(long *) &dtemp) - 0x80000000; }