From a4df6461796d51843614bffa7cd87d118ae33ab3 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Sun, 17 Nov 2013 20:42:29 -0800 Subject: [PATCH] Fixed fmin/fmax CRT library name collision. --- examples/14-shadowvolumes/shadowvolumes.cpp | 2 +- examples/common/fpumath.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index d83b37ac..e48f1290 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -1822,7 +1822,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f bool clipTest(const float* _planes, uint8_t _planeNum, const Mesh& _mesh, const float* _scale, const float* _translate) { float (*volumePlanes)[4] = (float(*)[4])_planes; - float scale = fmax(fmax(_scale[0], _scale[1]), _scale[2]); + float scale = fmaxf(fmaxf(_scale[0], _scale[1]), _scale[2]); const GroupArray& groups = _mesh.m_groups; for (GroupArray::const_iterator it = groups.begin(), itEnd = groups.end(); it != itEnd; ++it) diff --git a/examples/common/fpumath.h b/examples/common/fpumath.h index 723acab6..6d85d8ff 100644 --- a/examples/common/fpumath.h +++ b/examples/common/fpumath.h @@ -12,19 +12,21 @@ #include #include -inline float fmin(float _a, float _b) +#if BX_COMPILER_MSVC +inline float fminf(float _a, float _b) { return _a < _b ? _a : _b; } -inline float fmax(float _a, float _b) +inline float fmaxf(float _a, float _b) { return _a > _b ? _a : _b; } +#endif // BX_COMPILER_MSVC inline float fclamp(float _a, float _min, float _max) { - return fmin(fmax(_a, _min), _max); + return fminf(fmaxf(_a, _min), _max); } inline float fsaturate(float _a)