Skip to content

Commit

Permalink
Merge pull request #125 from Morpho-lang/bug118
Browse files Browse the repository at this point in the history
Change morpho_isfalse
  • Loading branch information
ConduitDan committed Apr 8, 2022
2 parents 3cdad63 + 328cb94 commit 14523eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions morpho5/datastructures/value.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#include "value.h"
#include "common.h"

/** Define notion of falsity/truthyness */
bool morpho_isfalse(value a) {
return (MORPHO_ISNIL(a) || (MORPHO_ISBOOL(a) && (MORPHO_GETBOOLVALUE(a)==false)));
}

DEFINE_VARRAY(value, value);

/** @brief Finds a value in an varray using a loose equality test (MORPHO_ISEQUAL)
Expand Down
4 changes: 1 addition & 3 deletions morpho5/datastructures/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ static inline bool morpho_isnumber(value a) {
#define MORPHO_FLOATTOINTEGER(x) (MORPHO_INTEGER((int) round(MORPHO_GETFLOATVALUE((x)))))

/** Define notion of falsity/truthyness */
static inline bool morpho_isfalse(value a) {
return (MORPHO_ISNIL(a) || (MORPHO_ISBOOL(a) && (MORPHO_GETBOOLVALUE(a)==false)));
}
bool morpho_isfalse(value a);

#define MORPHO_ISFALSE(x) (morpho_isfalse(x))
#define MORPHO_ISTRUE(x) (!morpho_isfalse(x))
Expand Down

0 comments on commit 14523eb

Please sign in to comment.