From e6328c84320e8e41edd8fb568d46c96fedff18db Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 12 Feb 2016 02:02:48 +0100 Subject: [PATCH] - enable fast floating point math in the subprojects that can benefit from it: dumb, gme and gdtoa. --- dumb/CMakeLists.txt | 4 ++++ game-music-emu/CMakeLists.txt | 5 +++++ gdtoa/CMakeLists.txt | 2 +- src/g_hexen/a_flechette.cpp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index 97a72b42c9..c8fa34bf7b 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -14,6 +14,10 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5") endif() +if( MSVC ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast" ) +endif() + CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) if( NOT ITOA_EXISTS ) add_definitions( -DNEED_ITOA=1 ) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index 27b065f42b..f1d467bcc0 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -29,6 +29,11 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) endif() endif() +if( MSVC ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast" ) +endif() + # Default emulators to build (all of them! ;) if (NOT DEFINED USE_GME_AY) diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index e0a6bab297..94ab9a6914 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -5,7 +5,7 @@ set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) # Disable warnings for << operator precedence (4554) and # unreferenced labels (4102) from VC if( MSVC ) - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102 /fp:fast" ) endif() if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index f26a6b41a1..7c8afb4cfc 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -332,7 +332,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage, FName damagetype) int damage = 15 + (pr_poisoncloudd()&15); if (mate) { - damage = (int)((float)damage * level.teamdamage); + damage = (int)((double)damage * level.teamdamage); } // Handle passive damage modifiers (e.g. PowerProtection) if (victim->Inventory != NULL)