Hi!
I wrote fixed point class to fasten physics calculations for my engine. But i found out that such code
overflows result if Value defined as long.
Now i fixed it by using
such cast, but i suspect using __int64 will slow down real-time calculations.
Can anyone suggest optimisation that allow me get rid of __int64?
I wrote fixed point class to fasten physics calculations for my engine. But i found out that such code
- Code:
inline fixed operator * (const fixed& a, const fixed& b)
{
fixed temp;
temp.Value = (a.Value * b.Value) >> STD_FIXED_PREC; //16
return temp;
}
overflows result if Value defined as long.
Now i fixed it by using
- Code:
temp.Value = ((__int64)a.Value * b.Value) >> STD_FIXED_PREC; //16
such cast, but i suspect using __int64 will slow down real-time calculations.
Can anyone suggest optimisation that allow me get rid of __int64?