Skip to content

Commit

Permalink
r_exec: In boolean operators equ(), etc. return true even if the bool…
Browse files Browse the repository at this point in the history
…ean result is false. See pull request #144.
  • Loading branch information
jefft0 committed Mar 17, 2021
1 parent eadc29a commit 4d98422
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions r_exec/operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool equ(const Context &context, uint16 &index) {

bool r = (lhs == rhs);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -146,7 +146,7 @@ bool neq(const Context &context, uint16 &index) {

bool r = *context.getChild(1) != *context.getChild(2);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -162,15 +162,15 @@ bool gtr(const Context &context, uint16 &index) {

bool r = lhs[0].asFloat() > rhs[0].asFloat();
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
} else if (lhs[0].getDescriptor() == Atom::TIMESTAMP) {

if (rhs[0].getDescriptor() == Atom::TIMESTAMP) {

bool r = Utils::GetTimestamp(&lhs[0]) > Utils::GetTimestamp(&rhs[0]);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
}

Expand All @@ -191,15 +191,15 @@ bool lsr(const Context &context, uint16 &index) {

bool r = lhs[0].asFloat() < rhs[0].asFloat();
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
} else if (lhs[0].getDescriptor() == Atom::TIMESTAMP) {

if (rhs[0].getDescriptor() == Atom::TIMESTAMP) {

bool r = Utils::GetTimestamp(&lhs[0]) < Utils::GetTimestamp(&rhs[0]);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
}

Expand All @@ -220,15 +220,15 @@ bool gte(const Context &context, uint16 &index) {

bool r = lhs[0].asFloat() >= rhs[0].asFloat();
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
} else if (lhs[0].getDescriptor() == Atom::TIMESTAMP) {

if (rhs[0].getDescriptor() == Atom::TIMESTAMP) {

bool r = Utils::GetTimestamp(&lhs[0]) >= Utils::GetTimestamp(&rhs[0]);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
}

Expand All @@ -249,15 +249,15 @@ bool lse(const Context &context, uint16 &index) {

bool r = lhs[0].asFloat() <= rhs[0].asFloat();
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
} else if (lhs[0].getDescriptor() == Atom::TIMESTAMP) {

if (rhs[0].getDescriptor() == Atom::TIMESTAMP) {

bool r = Utils::GetTimestamp(&lhs[0]) <= Utils::GetTimestamp(&rhs[0]);
index = context.setAtomicResult(Atom::Boolean(r));
return r;
return true;
}
}

Expand Down

0 comments on commit 4d98422

Please sign in to comment.