From f6b10ed439038e8adca546aa53b74b268ed80f49 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 13 Jul 2016 23:51:46 +0300 Subject: [PATCH] Operators priorities were inverted! --- Core/debugger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/debugger.c b/Core/debugger.c index f78c544e..8583dab2 100644 --- a/Core/debugger.c +++ b/Core/debugger.c @@ -175,7 +175,7 @@ static struct { {">=", 3, greater_equals}, {">", 3, greater}, {"==", 3, equals}, - {"=", 4, NULL, assign}, + {"=", -1, NULL, assign}, {"!=", 3, different}, }; @@ -327,7 +327,7 @@ uint16_t debugger_evaluate(GB_gameboy_t *gb, const char *string, for (int j = 0; j < sizeof(operators) / sizeof(operators[0]); j++) { if (strlen(operators[j].string) > length - i) continue; // Operator too big. // Priority higher than what we already have. - if (operator_index != -1 && operators[operator_index].priority > operators[j].priority) continue; + if (operator_index != -1 && operators[operator_index].priority < operators[j].priority) continue; unsigned long operator_length = strlen(operators[j].string); if (memcmp(string + i, operators[j].string, operator_length) == 0) { // Found an operator!