From d1b43acc0684a9e99bc95beb5f5d4f830b213cb8 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 16 Jul 2019 09:35:09 +0000 Subject: [PATCH] Use std::numeric_limits instead of float.h git-svn-id: https://svn.eduke32.com/eduke32@7799 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/compat.h | 3 +++ source/build/src/mdsprite.cpp | 4 ++-- source/duke3d/src/screens.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index ce267e673..24886f2f7 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -417,7 +417,9 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 || #include #include +#if !(defined _WIN32 && defined __clang__) #include +#endif #include #include @@ -427,6 +429,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 || #include #ifdef __cplusplus +# include # if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) # include # include diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index c6afaa8e0..04496ca32 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -2004,10 +2004,10 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) if (tspr->extra&TSPR_EXTRA_MDHACK) { #ifdef __arm__ // GL ES has a glDepthRangef and the loss of precision is OK there - float f = (float) (tspr->owner + 1) * (FLT_EPSILON * 8.0); + float f = (float) (tspr->owner + 1) * (std::numeric_limits::epsilon() * 8.0); if (f != 0.0) f *= 1.f/(float) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5); #else - double f = (double) (tspr->owner + 1) * (FLT_EPSILON * 8.0); + double f = (double) (tspr->owner + 1) * (std::numeric_limits::epsilon() * 8.0); if (f != 0.0) f *= 1.0/(double) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5); // glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR); #endif diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 514b1286e..3ca1e6787 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -788,8 +788,8 @@ static void G_PrintFPS(void) static int32_t frameCount; static double cumulativeFrameDelay; static double lastFrameTime; - static float lastFPS, minFPS = FLT_MAX, maxFPS; - static double minGameUpdate = DBL_MAX, maxGameUpdate; + static float lastFPS, minFPS = std::numeric_limits::max(), maxFPS; + static double minGameUpdate = std::numeric_limits::max(), maxGameUpdate; double frameTime = timerGetHiTicks(); double frameDelay = frameTime - lastFrameTime;