From f67faf0cefaf3a4457107383d58e71296f6f4b87 Mon Sep 17 00:00:00 2001 From: galanca Date: Thu, 2 Jun 2022 11:18:48 -0600 Subject: [PATCH 1/6] Hide FPCHECK. --- src/CNLOADS.CPP | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index c14dca4e8..c2fb3fedb 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -6580,7 +6580,9 @@ RC XSURF::xs_ASHWAT() // subhour calcs for ASHWAT fenestration { // shades closed xs_pFENAW[ 1]->fa_Subhr( min( fSC, 1.f), bDoFrm); } +#ifdef _WIN32 FPCHECK; +#endif return rc; } // XSURF::xs_ASHWAT @@ -6601,8 +6603,9 @@ RC XSURF::xs_SubhrQS() // subhour quick surface zx.zn_AccumBalTermsQS( xs_area, xs_sbcO, xs_sbcI); } } - +#ifdef _WIN32 FPCHECK; +#endif return rc; } // XSURF::xs_SubhrQS //----------------------------------------------------------------------------- From 1584455547144037ea60d066bb013080197b70fb Mon Sep 17 00:00:00 2001 From: galanca Date: Fri, 3 Jun 2022 08:34:25 -0600 Subject: [PATCH 2/6] Change static_assert to assert. --- src/CNLOADS.CPP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index c2fb3fedb..f4d654ee8 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -26,6 +26,7 @@ #include "array" #include "btwxt.h" +#include #ifdef COMFORT_MODEL #include "comfort/comfort.h" @@ -3381,7 +3382,7 @@ RC RSYS::rs_EndSubhr() // verify RSYSRES_IVL_SUB layout at compile time // fixed sequence allows array access by rs_mode (see code below) // rsmHEAT/rsmCOOL/rsmOAV definitions must be consistent with member sequences. -#define QZONECHK( m, oDif) static_assert( &((RSYSRES_IVL_SUB *)0)->m-&((RSYSRES_IVL_SUB *)0)->qhZoneSen == oDif, "Bad seq " #m) +#define QZONECHK( m, oDif) assert( &((RSYSRES_IVL_SUB *)0)->m-&((RSYSRES_IVL_SUB *)0)->qhZoneSen == oDif && "Bad seq " #m) QZONECHK(qhZoneSen, (rsmHEAT - 1) * 2); QZONECHK(qhZoneLat, (rsmHEAT - 1) * 2 + 1); QZONECHK(qcZoneSen, (rsmCOOL - 1) * 2); From d977ab8a910e3f72ad307e42630d9d2bb010d7c5 Mon Sep 17 00:00:00 2001 From: galanca Date: Fri, 3 Jun 2022 11:17:02 -0600 Subject: [PATCH 3/6] Fix static_assert for other platforms. --- src/CNLOADS.CPP | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index f4d654ee8..567963759 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -3382,13 +3382,13 @@ RC RSYS::rs_EndSubhr() // verify RSYSRES_IVL_SUB layout at compile time // fixed sequence allows array access by rs_mode (see code below) // rsmHEAT/rsmCOOL/rsmOAV definitions must be consistent with member sequences. -#define QZONECHK( m, oDif) assert( &((RSYSRES_IVL_SUB *)0)->m-&((RSYSRES_IVL_SUB *)0)->qhZoneSen == oDif && "Bad seq " #m) +#define QZONECHK( m, oDif) static_assert( offsetof(RSYSRES_IVL_SUB, m) - offsetof(RSYSRES_IVL_SUB, qhZoneSen) == oDif, "Bad seq " #m) QZONECHK(qhZoneSen, (rsmHEAT - 1) * 2); - QZONECHK(qhZoneLat, (rsmHEAT - 1) * 2 + 1); - QZONECHK(qcZoneSen, (rsmCOOL - 1) * 2); - QZONECHK(qcZoneLat, (rsmCOOL - 1) * 2 + 1); - QZONECHK(qvZoneSen, (rsmOAV - 1) * 2); - QZONECHK(qvZoneLat, (rsmOAV - 1) * 2 + 1); + QZONECHK(qhZoneLat, (rsmHEAT - 1) * 2 + sizeof(float)); + QZONECHK(qcZoneSen, (rsmCOOL - 1) * 2 * sizeof(float)); + QZONECHK(qcZoneLat, (rsmCOOL - 1) * 2 * sizeof(float) + sizeof(float)); + QZONECHK(qvZoneSen, (rsmOAV - 1) * 2 * sizeof(float)); + QZONECHK(qvZoneLat, (rsmOAV - 1) * 2 * sizeof(float) + sizeof(float)); static_assert(rsmCOUNT == 4, "Bad rsm enum"); #undef QZONECHK From bc2989bb9bef32314e9fce04e81f3c3e4db4b4ba Mon Sep 17 00:00:00 2001 From: galanca Date: Fri, 3 Jun 2022 11:18:23 -0600 Subject: [PATCH 4/6] Delete include that was previously added. --- src/CNLOADS.CPP | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index 567963759..1e834d450 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -26,7 +26,6 @@ #include "array" #include "btwxt.h" -#include #ifdef COMFORT_MODEL #include "comfort/comfort.h" From 4144b7c5258363d9015b6c19f5661cf07a722315 Mon Sep 17 00:00:00 2001 From: Cesar Galan Date: Fri, 3 Jun 2022 11:40:25 -0600 Subject: [PATCH 5/6] Set FPCHECK as nothing all platforms other than Windows. --- src/CNGLOB.H | 4 ++++ src/CNLOADS.CPP | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CNGLOB.H b/src/CNGLOB.H index 794db24e5..2a9fbda2a 100644 --- a/src/CNGLOB.H +++ b/src/CNGLOB.H @@ -182,8 +182,12 @@ typedef std::string WStr; /*------------------------------- math -------------------------------------*/ // error handling extern UINT doControlFP(); +#ifdef _WIN32 #define FPCHECK __asm { fwait } // trap pending FP exception (if any) // re searching for FP exceptions +#else +#define FPCHECK +#endif // min and max (converted to template fcns, 10-12) #undef min diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index 1e834d450..aa03cb8f3 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -6580,9 +6580,7 @@ RC XSURF::xs_ASHWAT() // subhour calcs for ASHWAT fenestration { // shades closed xs_pFENAW[ 1]->fa_Subhr( min( fSC, 1.f), bDoFrm); } -#ifdef _WIN32 FPCHECK; -#endif return rc; } // XSURF::xs_ASHWAT @@ -6603,9 +6601,7 @@ RC XSURF::xs_SubhrQS() // subhour quick surface zx.zn_AccumBalTermsQS( xs_area, xs_sbcO, xs_sbcI); } } -#ifdef _WIN32 FPCHECK; -#endif return rc; } // XSURF::xs_SubhrQS //----------------------------------------------------------------------------- From a43d74f68fd955142133951f6c07bb031e521ebc Mon Sep 17 00:00:00 2001 From: Cesar Galan Date: Fri, 3 Jun 2022 11:51:29 -0600 Subject: [PATCH 6/6] Add extra line. --- src/CNLOADS.CPP | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CNLOADS.CPP b/src/CNLOADS.CPP index aa03cb8f3..2f8cf90be 100644 --- a/src/CNLOADS.CPP +++ b/src/CNLOADS.CPP @@ -6601,6 +6601,7 @@ RC XSURF::xs_SubhrQS() // subhour quick surface zx.zn_AccumBalTermsQS( xs_area, xs_sbcO, xs_sbcI); } } + FPCHECK; return rc; } // XSURF::xs_SubhrQS