diff options
-rw-r--r-- | qtmips_gui/fixmatheval.cpp | 9 | ||||
-rw-r--r-- | qtmips_machine/instruction.cpp | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/qtmips_gui/fixmatheval.cpp b/qtmips_gui/fixmatheval.cpp index f695e30..c06d892 100644 --- a/qtmips_gui/fixmatheval.cpp +++ b/qtmips_gui/fixmatheval.cpp @@ -231,7 +231,11 @@ bool FmeExpression::parse(const QString &expression, QString &error) { FmeValue (*binary_op)(FmeValue &a, FmeValue &b) = nullptr; FmeValue (*unary_op)(FmeValue &a) = nullptr; int prio = base_prio; - if (ch == '-') { + + if (ch == '~') { + prio += 90; + unary_op = [](FmeValue &a) -> FmeValue { return ~a; }; + } else if (ch == '-') { if (is_unary) { prio += 90; unary_op = [](FmeValue &a) -> FmeValue { return -a; }; @@ -256,6 +260,9 @@ bool FmeExpression::parse(const QString &expression, QString &error) { } else if (ch == '&') { binary_op = [](FmeValue &a, FmeValue &b) -> FmeValue { return a & b; }; prio += 15; + } else if (ch == '^') { + binary_op = [](FmeValue &a, FmeValue &b) -> FmeValue { return a ^ b; }; + prio += 15; } else if (ch == '(') { base_prio += 100; } else if (ch == ')') { diff --git a/qtmips_machine/instruction.cpp b/qtmips_machine/instruction.cpp index 6792aa6..f62605b 100644 --- a/qtmips_machine/instruction.cpp +++ b/qtmips_machine/instruction.cpp @@ -1045,7 +1045,7 @@ static void reloc_append(RelocExpressionList *reloc, QString fl, uint32_t inst_a uint bits = IMF_SUB_GET_BITS(adesc->loc); uint shift = IMF_SUB_GET_SHIFT(adesc->loc); QString expression = ""; - QString allowed_operators = "+-/*|&"; + QString allowed_operators = "+-/*|&^~"; int i = 0; for (; i < fl.size(); i++) { QChar ch = fl.at(i); |