Skip to content

Commit

Permalink
Add function to enable some FP exceptions (for debugging purposes).
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd002 committed Jul 29, 2020
1 parent f6f2af4 commit b37c87f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/FpUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ void FpUtils::SetDenormalHandlingMode()
#endif
}

void FpUtils::EnableFpExceptions()
{
#ifdef _WIN32
unsigned int currentState = 0;
_controlfp_s(&currentState, _MCW_EM & ~(_EM_ZERODIVIDE | _EM_INVALID), _MCW_EM);
#endif
}

void FpUtils::IsZero(CMipsJitter* codeGen, size_t offset)
{
//Check wether an FP number is +/-0
Expand Down
1 change: 1 addition & 0 deletions Source/FpUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class CMipsJitter;
namespace FpUtils
{
void SetDenormalHandlingMode();
void EnableFpExceptions();

void IsZero(CMipsJitter*, size_t);
void ComputeDivisionByZero(CMipsJitter*, size_t, size_t);
Expand Down

0 comments on commit b37c87f

Please sign in to comment.