Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Use C++11 std::isnan and std::isfinite, and don't include an unneeded header on linux. #294

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/nvmath/nvmath.h
Expand Up @@ -10,7 +10,9 @@

#include <math.h>

#if NV_OS_WIN32 || NV_OS_XBOX
#if NV_CC_CPP11
#include <cmath>
#elif NV_OS_WIN32 || NV_OS_XBOX
#include <float.h> // finite, isnan
#endif

Expand Down Expand Up @@ -168,7 +170,9 @@ namespace nv

inline bool isFinite(const float f)
{
#if NV_OS_WIN32 || NV_OS_XBOX
#if NV_CC_CPP11
return std::isfinite(f);
#elif NV_OS_WIN32 || NV_OS_XBOX
return _finite(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS
return isfinite(f);
Expand All @@ -177,13 +181,13 @@ namespace nv
#else
# error "isFinite not supported"
#endif
//return std::isfinite (f);
//return finite (f);
}

inline bool isNan(const float f)
{
#if NV_OS_WIN32 || NV_OS_XBOX
#if NV_CC_CPP11
return std::isnan(f);
#elif NV_OS_WIN32 || NV_OS_XBOX
return _isnan(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS
return isnan(f);
Expand Down
2 changes: 2 additions & 0 deletions src/nvthread/nvthread.cpp
Expand Up @@ -8,7 +8,9 @@
#include "Win32.h"
#elif NV_OS_UNIX
#include <sys/types.h>
#if !NV_OS_LINUX
#include <sys/sysctl.h>
#endif
#include <unistd.h>
#elif NV_OS_DARWIN
#import <stdio.h>
Expand Down