From 757330bff425a9918cafa57dd02d2d2746072a33 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 23 Jul 2022 07:42:33 +0300 Subject: [PATCH] Add pointer vs int equality check --- src/interpreter.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/interpreter.cc b/src/interpreter.cc index 6f0048b..6277ea5 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -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;