Skip to content

Commit

Permalink
Refactor includes and add NaN/Inf check function
Browse files Browse the repository at this point in the history
Moved `#define _GNU_SOURCE` to the top of the file to ensure GNU-specific features are available before any includes. Reordered `#include` directives to avoid potential conflicts by placing them after platform-specific headers. Added a new static function `octaveMexIsNanOrInfDouble` to check if a double value is NaN or infinity using `mxIsNaN` and `mxIsInf`.
  • Loading branch information
ptahmose committed Oct 18, 2024
1 parent de5ad99 commit 9c50447
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions OctaveMex/octavelibczi.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#define MX_HAS_INTERLEAVED_COMPLEX 1
#include "mex.h"
#include "../AppModel/include/app_api.h"
#include <string.h>
#define _GNU_SOURCE
#ifdef _WIN32
#include <Windows.h>
#else
#define _GNU_SOURCE
#include <dlfcn.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#endif

#include "mex.h"
#include "../AppModel/include/app_api.h"
#include <string.h>

static bool octaveMexIsNanOrInfDouble(double value)
{
return mxIsNaN(value) || mxIsInf(value);
Expand Down

0 comments on commit 9c50447

Please sign in to comment.