Skip to content

Commit

Permalink
Add pointer vs int equality check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov committed Jul 23, 2022
1 parent f3869e0 commit 757330b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/interpreter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,18 @@ static void opConditionalOperatorEqual(Program* program)
case VALUE_TYPE_INT:
result = value[1].integerValue == value[0].integerValue;
break;
case VALUE_TYPE_PTR:
result = (intptr_t)(value[1].integerValue) == (intptr_t)(value[0].pointerValue);
break;
default:
assert(false && "Should be unreachable");
}
break;
case VALUE_TYPE_PTR:
switch (value[0].opcode) {
case VALUE_TYPE_INT:
result = (intptr_t)(value[1].pointerValue) == (intptr_t)(value[0].integerValue);
break;
case VALUE_TYPE_PTR:
result = value[1].pointerValue == value[0].pointerValue;
break;
Expand Down

0 comments on commit 757330b

Please sign in to comment.