aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-05-06 16:04:21 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-05-06 16:04:21 +0100
commite3f93f203a1b47a31fef21219955335476857d90 (patch)
tree992c98cd6e1ca718539c651839da555149459c3f
parent196e84b11515d10fb4023a7d5975b2cd0b2d1271 (diff)
downloadCompiler-e3f93f203a1b47a31fef21219955335476857d90.tar.gz
Compiler-e3f93f203a1b47a31fef21219955335476857d90.zip
Fixed decrement again
-rw-r--r--c_compiler/src/expression.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/c_compiler/src/expression.cpp b/c_compiler/src/expression.cpp
index 775cdaa..8f37136 100644
--- a/c_compiler/src/expression.cpp
+++ b/c_compiler/src/expression.cpp
@@ -301,7 +301,7 @@ Bindings PostfixPostIncDecExpression::printAsm(Bindings bindings, int &label_cou
if(operator_ == "++")
printf("\taddiu\t$3,$2,1\n");
else if(operator_ == "--")
- printf("\tsubiu\t$3,$2,1\n");
+ printf("\taddiu\t$3,$2,65535\n");
else
throw std::runtime_error("Error : '"+operator_+"' not recognized");
@@ -343,9 +343,9 @@ Bindings UnaryPreIncDecExpression::printAsm(Bindings bindings, int &label_count)
{
unary_expression_->printAsm(bindings, label_count);
if(operator_ == "++")
- printf("\taddi\t$2,$2,1\n");
+ printf("\taddiu\t$2,$2,1\n");
else if(operator_ == "--")
- printf("\taddi\t$2,$2,65535\n");
+ printf("\taddiu\t$2,$2,65535\n");
else
throw std::runtime_error("Error : '"+operator_+"' not recognized");