From ae470b42f102d5da4f7d4255a47e3cf582079f33 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 15 Sep 2020 22:21:15 -0700 Subject: 6781 - new app: RPN (postfix) calculator This was surprisingly hard; bugs discovered all over the place. --- apps/mu.subx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apps/mu.subx') 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) -- cgit 1.4.1-2-gfad0