Fixes for MSVC

This commit is contained in:
2025-07-02 14:19:05 -07:00
parent 9010650ceb
commit 9ea63478e5
22 changed files with 468 additions and 285 deletions

View File

@@ -19,11 +19,20 @@
#ifndef FENNEC_MATH_DETAIL_MATH_H
#define FENNEC_MATH_DETAIL_MATH_H
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable:4117)
#endif
#pragma push_macro("__cplusplus")
#undef __cplusplus
#include <math.h>
#pragma pop_macro("__cplusplus")
#if _MSC_VER
#pragma warning(pop)
#endif
#undef div
#undef acos
#undef asin

View File

@@ -114,7 +114,7 @@ constexpr matrix<scalar, rows, cols...> inverse(const matrix<scalar, rows, cols.
// Should check for 0 determinant
scalar invdet = (s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0);
invdet = invdet ? 1.0 / invdet : 0; // this will get reduced to cmov, div still happens
invdet = invdet ? scalar(1.0) / invdet : scalar(0); // this will get reduced to cmov, div still happens
matrix<scalar, rows, cols...> i(
( m[1][1] * c5 - m[1][2] * c4 + m[1][3] * c3) * invdet