From d2fc3ad2272f7cc850ef95fbe803c10e8746ad86 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Oct 2021 21:34:32 +0200 Subject: Switched to long doubles instead of doing manual FPU manipulation --- Stars45/StarSystem.cpp | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'Stars45/StarSystem.cpp') diff --git a/Stars45/StarSystem.cpp b/Stars45/StarSystem.cpp index 8daed31..3c91f99 100644 --- a/Stars45/StarSystem.cpp +++ b/Stars45/StarSystem.cpp @@ -54,34 +54,17 @@ #include "Scene.h" #include "ParseUtil.h" -const double epoch = 0.5e9; -double StarSystem::stardate = 0; +const long double epoch = 0.5e9; +long double StarSystem::stardate = 0; // +====================================================================+ -static double base_time = 0; +static long double base_time = 0; static WORD oldcw = 0; static WORD fpcw = 0; -void FPU2Extended() +void StarSystem::SetBaseTime(long double t, bool absolute) { - _asm { fstcw oldcw } - fpcw = oldcw | 0x0300; // set 80-bit precision mode - _asm { fldcw fpcw } -} - -void FPURestore() -{ - // well, I don't actually WANT single-precision mode - // so I think I'll just ignore this... - - //_asm { fldcw oldcw } -} - -void StarSystem::SetBaseTime(double t, bool absolute) -{ - FPU2Extended(); - if (absolute) { base_time = t; CalcStardate(); @@ -94,7 +77,7 @@ void StarSystem::SetBaseTime(double t, bool absolute) } } -double StarSystem::GetBaseTime() +long double StarSystem::GetBaseTime() { return base_time; } @@ -111,14 +94,10 @@ void StarSystem::CalcStardate() base_time += epoch; } - FPU2Extended(); - - double gtime = (double) Game::GameTime() / 1000.0; - double sdate = gtime + base_time + epoch; + long double gtime = (long double) Game::GameTime() / 1000.0; + long double sdate = gtime + base_time + epoch; stardate = sdate; - - FPURestore(); } static const double GRAV = 6.673e-11; -- cgit v1.1