1 #include "rt_def.h" 2 3 #include "watcom.h" 4 5 #if 0 6 /* 7 C versions of watcom.h assembly. 8 Uses the '__int64' type (see rt_def.h). 9 */ 10 11 fixed FixedMul(fixed a, fixed b) 12 { 13 /* __int64 x = a; 14 __int64 y = b; 15 __int64 z = x * y + 0x8000; 16 17 return (z >> 16) & 0xffffffff; 18 */ 19 return ((__int64)a*b + 0x8000)>>16; 20 } 21 22 fixed FixedMulShift(fixed a, fixed b, fixed shift) 23 { 24 /* __int64 x = a; 25 __int64 y = b; 26 __int64 z = x * y; 27 28 return (((unsigned __int64)z) >> shift) & 0xffffffff; 29 */ 30 return (unsigned __int64)((__int64)a*b)>>shift; 31 } 32 33 fixed FixedDiv2(fixed a, fixed b) 34 { 35 /* 36 __int64 x = (signed long)a; 37 __int64 y = (signed long)b; 38 __int64 z = x * 65536 / y; 39 40 return (z) & 0xffffffff; 41 */ 42 return (float)a*65536.0f/b; 43 } 44 45 fixed FixedScale(fixed orig, fixed factor, fixed divisor) 46 { 47 /* 48 __int64 x = orig; 49 __int64 y = factor; 50 __int64 z = divisor; 51 52 __int64 w = (x * y) / z; 53 54 return (w) & 0xffffffff; 55 */ 56 return (float)orig * factor / divisor; 57 } 58 #endif 59