Skip to content

Commit a7e07c8

Browse files
andy5995claude
andcommitted
sync: Remove streflop library and all associated dead code
streflop is no longer needed: the four atan2 calls that affected sync-logged game state now use deterministicAtan2Deg() (previous commit), and the remaining streflop uses (fabs, floor, sqrt) are inherently deterministic under IEEE 754. Source file cleanup ------------------- Every #ifdef USE_STREFLOP / streflop:: / #else / stdlib / #endif block is collapsed to the stdlib branch: unit_updater.cpp - floor() for range checks map_preview.cpp - sqrtf() distance, fabs() gradient particle.cpp - fabsf/sinf/cosf/sqrtf/fmod/cos/sin/atan2 (all rendering-only, no sync impact) vec.h - std::sqrt() in Vec2/Vec3::length() main.cpp - remove STREFLOP mode/enabled log prints math_wrapper.h - unconditional #include <cmath> lua_script.cpp: remove Lua_STREFLOP_Wrapper class and all ~25 instances. The class toggled streflop precision around Lua calls to avoid FPU state corruption; with streflop gone it is a no-op. platform_main.h --------------- - Remove --disable-streflop-checks CLI arg and GAME_ARG enum value - Remove the SSE capability runtime check (was only needed to validate streflop's SSE mode requirement) - Remove streflop_init<streflop::Simple>() startup call CMakeLists.txt -------------- - Remove WANT_USE_STREFLOP and FORCE_STREFLOP_SOFTWRAPPER options - Remove the STREFLOP_SSE/X87/SOFT detection and ADD_DEFINITIONS block source/shared_lib/CMakeLists.txt --------------------------------- - Remove pkg_search_module(STREFLOP …) discovery - Remove ADD_SUBDIRECTORY(sources/streflop) and link step - Remove ${STREFLOP_PROPERTIES} from compile flags - Remove ${MG_STREFLOP} from Windows link libraries Deleted files ------------- source/shared_lib/sources/streflop/ (~70 .cpp files) source/shared_lib/include/streflop/ (~20 .h files) source/shared_lib/include/platform/common/streflop_cond.h source/tests/shared_lib/streflop/ (OOS regression test) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 08ebc27 commit a7e07c8

115 files changed

Lines changed: 1 addition & 21084 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ OPTION(WANT_STATIC_LIBS "Builds as many static libs as possible." OFF)
100100
OPTION(WANT_USE_OpenSSL "Use libOpenSSL during CURL linking." ON)
101101
OPTION(WANT_USE_FriBiDi "Enable libFriBIDi support." ON)
102102
OPTION(WANT_USE_GoogleBreakpad "Enable GoogleBreakpad support." ON)
103-
OPTION(WANT_USE_STREFLOP "Use the library streflop." OFF)
104103
OPTION(WANT_USE_XercesC "Enable libXercesC support." OFF)
105104

106105
FIND_PROGRAM(HELP2MAN "help2man")
@@ -263,39 +262,6 @@ endforeach()
263262
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
264263
#MESSAGE(STATUS "*TEST: Checking for max SSE LEVEL [${FORCE_MAX_SSE_LEVEL}]")
265264

266-
OPTION(FORCE_STREFLOP_SOFTWRAPPER "Set the streflop library to be forced to use the software emulator" OFF)
267-
IF(NOT FORCE_MAX_SSE_LEVEL AND NOT FORCE_STREFLOP_SOFTWRAPPER)
268-
SET(FORCE_MAX_SSE_LEVEL "1" CACHE STRING "Set the max SSE level to use if supported (0-3)")
269-
ENDIF()
270-
271-
IF(NOT FORCE_STREFLOP_SOFTWRAPPER)
272-
MESSAGE(STATUS "*NOTE: Checking for max SSE LEVEL [${FORCE_MAX_SSE_LEVEL}]")
273-
special_check_for_sse( ${FORCE_MAX_SSE_LEVEL} )
274-
ENDIF()
275-
276-
IF(WANT_USE_STREFLOP)
277-
ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32 -DN_SPECIALIZED=32")
278-
279-
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0" AND NOT FORCE_STREFLOP_SOFTWRAPPER)
280-
ADD_DEFINITIONS("-DSTREFLOP_SSE")
281-
MESSAGE(STATUS "*NOTE: using SSE for STREFLOP.")
282-
ELSE()
283-
IF(NOT FORCE_STREFLOP_SOFTWRAPPER)
284-
special_check_for_x87()
285-
ENDIF()
286-
287-
IF(HAS_X87_SUPPORT AND NOT FORCE_STREFLOP_SOFTWRAPPER)
288-
ADD_DEFINITIONS("-DSTREFLOP_X87")
289-
MESSAGE(STATUS "*NOTE: using X87 for STREFLOP.")
290-
ELSE()
291-
ADD_DEFINITIONS("-DSTREFLOP_SOFT")
292-
MESSAGE(STATUS "*NOTE: using SOFT emulation for STREFLOP.")
293-
ENDIF()
294-
ENDIF()
295-
ELSE()
296-
MESSAGE(STATUS "*NOTE: STREFLOP disabled. atan2 calls that feed into sync state use deterministicAtan2Deg() instead.")
297-
ENDIF()
298-
299265
include(CheckCXXSourceRuns)
300266

301267
check_cxx_source_runs("

source/glest_game/main/main.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,29 +4364,7 @@ int glestMain(int argc, char **argv) {
43644364

43654365
printf("\nGIT: [%s]", getGITRevisionString().c_str());
43664366

4367-
#ifdef USE_STREFLOP
4368-
4369-
#if defined(STREFLOP_SSE)
4370-
const char *instruction_set = "[SSE]";
4371-
#elif defined(STREFLOP_X87)
4372-
const char *instruction_set = "[X87]";
4373-
#elif defined(STREFLOP_SOFT)
4374-
const char *instruction_set = "[SOFTFLOAT]";
4375-
#else
4376-
const char *instruction_set = "[none]";
4377-
#endif
4378-
4379-
#if defined(STREFLOP_NO_DENORMALS)
4380-
const char *denormals = "[no-denormals]";
4381-
#else
4382-
const char *denormals = "[denormals]";
4383-
#endif
4384-
4385-
printf(" - using STREFLOP %s - %s\n", instruction_set, denormals);
4386-
4387-
#else
43884367
printf("\n");
4389-
#endif
43904368
}
43914369

43924370
setGameVersion(glestVersionString);
@@ -4923,11 +4901,7 @@ int glestMain(int argc, char **argv) {
49234901
NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
49244902
MenuStateMasterserver::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
49254903

4926-
#ifdef USE_STREFLOP
4927-
SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s, STREFLOP enabled.\n", getNetworkVersionString().c_str());
4928-
#else
49294904
SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s, STREFLOP NOT enabled.\n", getNetworkVersionString().c_str());
4930-
#endif
49314905

49324906
SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__);
49334907
SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "START\n");

source/glest_game/world/unit_updater.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,11 +3490,7 @@ vector<Unit *> UnitUpdater::findUnitsInRange(const Unit *unit, int radius) {
34903490
for (int i = center.x - range; i < center.x + range + size; ++i) {
34913491
for (int j = center.y - range; j < center.y + range + size; ++j) {
34923492
// cells inside map and in range
3493-
#ifdef USE_STREFLOP
3494-
if (map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range + 1)) {
3495-
#else
34963493
if (map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range + 1)) {
3497-
#endif
34983494
Cell *cell = map->getCell(i, j);
34993495
findUnitsForCell(cell, units);
35003496
}

source/shared_lib/CMakeLists.txt

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,14 @@
1-
#########################################################################################
2-
# streflop
3-
41
OPTION(FORCE_EMBEDDED_LIBS "Force use of embedded libraries' code." OFF)
52

63
# IMPORTANT: should come BEFORE finding packages
74
IF(NOT MSVC)
85
find_package(PkgConfig REQUIRED)
96
ENDIF()
107

11-
IF(FORCE_STREFLOP_SOFTWRAPPER)
12-
pkg_search_module(STREFLOP streflop-soft)
13-
ELSE()
14-
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
15-
pkg_search_module(STREFLOP streflop-sse)
16-
ELSE()
17-
IF(HAS_X87_SUPPORT)
18-
pkg_search_module(STREFLOP streflop-x87)
19-
ELSE()
20-
pkg_search_module(STREFLOP streflop-soft)
21-
ENDIF()
22-
ENDIF()
23-
ENDIF()
24-
IF(NOT STREFLOP_FOUND)
25-
pkg_search_module(STREFLOP streflop)
26-
ENDIF()
27-
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
28-
298
IF(FORCE_EMBEDDED_LIBS)
30-
SET(STREFLOP_FOUND OFF)
319
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
3210
ENDIF()
3311

34-
IF(WANT_USE_STREFLOP)
35-
IF(NOT STREFLOP_FOUND)
36-
ADD_SUBDIRECTORY(sources/streflop)
37-
ELSE()
38-
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
39-
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
40-
41-
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
42-
ENDIF()
43-
ENDIF()
44-
4512
#########################################################################################
4613
# common libraries
4714

@@ -266,14 +233,6 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
266233
util
267234
xml)
268235

269-
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
270-
SET(DIRS_WITH_SRC
271-
${DIRS_WITH_SRC}
272-
streflop
273-
streflop/libm_flt32_source
274-
streflop/softfloat)
275-
ENDIF()
276-
277236
IF(FORCE_EMBEDDED_LIBS)
278237
SET(FORCE_USE_EMBEDDED_Miniupnpc ON)
279238
ELSE()
@@ -466,7 +425,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
466425
ENDIF()
467426

468427
SET_SOURCE_FILES_PROPERTIES(${MG_SOURCE_FILES} PROPERTIES COMPILE_FLAGS
469-
"${PLATFORM_SPECIFIC_DEFINES} ${STREFLOP_PROPERTIES} ${CXXFLAGS}")
428+
"${PLATFORM_SPECIFIC_DEFINES} ${CXXFLAGS}")
470429

471430
SET_SOURCE_FILES_PROPERTIES(${MG_INCLUDE_FILES} PROPERTIES HEADER_FILE_ONLY 1)
472431

@@ -517,7 +476,6 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
517476
TARGET_LINK_LIBRARIES(${TARGET_NAME}
518477
${JPEG_LIBRARIES}
519478
${LUA_LIBRARIES}
520-
${MG_STREFLOP}
521479
${COMMON_LIBS}
522480
ftgl
523481
gdi32
@@ -530,9 +488,6 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
530488
ENDIF()
531489
ENDIF()
532490

533-
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
534-
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
535-
ENDIF()
536491
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS} ${COMMON_LIBS})
537492

538493
#IF(MINIUPNP_DEBUG_BUILD)

source/shared_lib/include/graphics/vec.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,8 @@ template <typename T> class Vec2 {
228228
inline bool operator<(const Vec2<T> &v) const { return x < v.x || (x == v.x && y < v.y); }
229229

230230
inline float length() const {
231-
#ifdef USE_STREFLOP
232-
float len = static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x * x + y * y)));
233-
#else
234231
float len = static_cast<float>(std::sqrt(static_cast<float>(x * x + y * y)));
235232
len = truncateDecimal<float>(len, 6);
236-
#endif
237233
return len;
238234
}
239235

@@ -422,12 +418,8 @@ template <typename T> class Vec3 {
422418
}
423419

424420
inline float length() const {
425-
#ifdef USE_STREFLOP
426-
float len = static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x * x + y * y + z * z)));
427-
#else
428421
float len = static_cast<float>(std::sqrt(x * x + y * y + z * z));
429422
len = truncateDecimal<float>(len, 6);
430-
#endif
431423
return len;
432424
}
433425

source/shared_lib/include/platform/common/math_wrapper.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,8 @@
1212
#ifndef _SHARED_PLATFORMCOMMON_MATHWRAPPER_H_
1313
#define _SHARED_PLATFORMCOMMON_MATHWRAPPER_H_
1414

15-
#ifdef USE_STREFLOP
16-
17-
#include <cmath>
18-
#include <streflop_cond.h>
19-
20-
#else
21-
2215
#include <cmath>
2316

24-
#endif
25-
2617
#include "leak_dumper.h"
2718

2819
#endif

source/shared_lib/include/platform/common/streflop_cond.h

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)