Fixed compilation issues with isnan()

Need to do it in pure C++ way to avoid C99 macro at all costs
Tested with CI targets, on Debian Jessie using GCC 4.9 and on Ubuntu 16.04 using GCC 5.4
This commit is contained in:
alexey.lysiuk 2017-03-28 17:10:06 +03:00
parent 6816902a09
commit 4716b712b1
1 changed files with 2 additions and 8 deletions

View File

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <cmath>
#include "doomdef.h"
#include "doomstat.h"
@ -42,13 +43,6 @@
#include "swrenderer/r_renderthread.h"
#include "swrenderer/r_memory.h"
#ifndef isnan
// Fallback to C++ function if C99 isnan() macro is not undefined
// Most likely it was undefined in C++ library header to avoid conflicts with own function
#include <cmath>
using std::isnan;
#endif // !isnan
namespace swrenderer
{
WallSampler::WallSampler(RenderViewport *viewport, int y1, double texturemid, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture)
@ -106,7 +100,7 @@ namespace swrenderer
v = v - floor(v);
double v_step = uv_stepd / texture->GetHeight();
if (isnan(v) || isnan(v_step)) // this should never happen, but it apparently does..
if (std::isnan(v) || std::isnan(v_step)) // this should never happen, but it apparently does..
{
uv_stepd = 0.0;
v = 0.0;