about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-15 22:21:15 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-15 22:52:41 -0700
commitae470b42f102d5da4f7d4255a47e3cf582079f33 (patch)
treeaa251ea7734370b9c152a5cf08a7b97c9c1de0c1 /apps/mu.subx
parent8815cf7d57e738731dfc43680b4eccbaef9d822c (diff)
downloadmu-ae470b42f102d5da4f7d4255a47e3cf582079f33.tar.gz
6781 - new app: RPN (postfix) calculator
This was surprisingly hard; bugs discovered all over the place.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 1b68350f..b3cb99de 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -14518,6 +14518,13 @@ size-of-type-id:  # t: type-id -> result/eax: int
       b8/copy-to-eax 8/imm32
       eb/jump $size-of-type-id:end/disp8  # eax changes type from type-id to int
     }
+    # if t is a slice, return 8
+    3d/compare-eax-and 0xc/imm32/slice
+    {
+      75/jump-if-!= break/disp8
+      b8/copy-to-eax 8/imm32
+      eb/jump $size-of-type-id:end/disp8  # eax changes type from type-id to int
+    }
     # if t is a user-defined type, return its size
     # TODO: support non-atom type
     (find-typeinfo %eax %ecx)