summaryrefslogtreecommitdiff
path: root/pp2cc.py
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2011-12-06 16:56:06 +0000
committerPeter Wu <lekensteyn@gmail.com>2011-12-06 16:56:06 +0000
commitf53bf21c6ad9fb3d2f1a40e2ce06816a6b2e3106 (patch)
tree0bdc837874ef233768bed43a02bd2ed3f8101e1f /pp2cc.py
parent6e8c92a69c6f7abe88d98e729e06bca6ccf17d72 (diff)
downloadpp2cc-f53bf21c6ad9fb3d2f1a40e2ce06816a6b2e3106.tar.gz
Add tests for memory address handling, fix compiler for negative constant
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-xpp2cc.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pp2cc.py b/pp2cc.py
index 2f58f9b..81f6a79 100755
--- a/pp2cc.py
+++ b/pp2cc.py
@@ -1317,7 +1317,8 @@ class Parse(object):
linked_node))
if op == "-":
# negating a value in PP2 is flipping the WORDSIZE-th bit
- value = operand ^ msb
+ value = -operand
+ #(operand ^ (pow(2, self.WORDSIZE) - 1)) + 1
elif op == "~":
# invert all bits
value = operand ^ (pow(2, self.WORDSIZE) - 1)