about summary refs log tree commit diff stats
path: root/406try-divide.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-21 21:27:44 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-21 21:27:44 -0700
commite655f673b5e1b421fbafe45f91e96ba6a7de4cfe (patch)
treee92c385446992f4823d392539eac3eb9f3b860e2 /406try-divide.mu
parent2404478a7f08500176f128a332fce6e8eae67322 (diff)
downloadmu-e655f673b5e1b421fbafe45f91e96ba6a7de4cfe.tar.gz
6829 - tile: colorize values on the stack
Diffstat (limited to '406try-divide.mu')
-rw-r--r--406try-divide.mu8
1 files changed, 8 insertions, 0 deletions
diff --git a/406try-divide.mu b/406try-divide.mu
index 9c7a0229..7f5defad 100644
--- a/406try-divide.mu
+++ b/406try-divide.mu
@@ -81,3 +81,11 @@ fn test-try-divide-9 {
   var result/eax: int <- try-divide 0x1c, 3  # 28/3
   check-ints-equal result, 9, "F - try-divide-9\n"
 }
+
+# only positive inouts for now
+fn try-modulo nr: int, dr: int -> result/eax: int {
+  var tmp/eax: int <- try-divide nr, dr
+  tmp <- multiply dr
+  tmp <- subtract nr
+  result <- negate
+}