about summary refs log tree commit diff stats
path: root/shell/primitives.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-26 02:27:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-26 02:27:32 -0700
commit46441d7204cb14e14bc25ff3c43a912281035a1c (patch)
tree615ee983f8c6ed7b62dc6d7c8e66bd6fe38d21dc /shell/primitives.mu
parent81c3678515e9fe848daeec129918a7baf929bf96 (diff)
downloadmu-46441d7204cb14e14bc25ff3c43a912281035a1c.tar.gz
.
Smoked out some issues by rendering a single frame of Game of Life.
Incredibly slow.
Diffstat (limited to 'shell/primitives.mu')
-rw-r--r--shell/primitives.mu13
1 files changed, 9 insertions, 4 deletions
diff --git a/shell/primitives.mu b/shell/primitives.mu
index daf62fe4..b511cc01 100644
--- a/shell/primitives.mu
+++ b/shell/primitives.mu
@@ -3641,14 +3641,19 @@ fn apply-index _args-ah: (addr handle cell), out: (addr handle cell), trace: (ad
     return
   }
   var second-value/eax: (addr float) <- get second, number-data
-  var index/edx: int <- convert *second-value
+  var index/edx: int <- truncate *second-value
   var data-ah/eax: (addr handle array handle cell) <- get first, array-data
   var data/eax: (addr array handle cell) <- lookup *data-ah
   {
     var len/eax: int <- length data
     compare index, len
     break-if-<
-    error trace, "too few elements in array"
+    error trace, "index: too few elements in array"
+    compare index, len
+    {
+      break-if-<=
+      error trace, "foo"
+    }
     return
   }
   var offset/edx: (offset handle cell) <- compute-offset data, index
@@ -3716,13 +3721,13 @@ fn apply-iset _args-ah: (addr handle cell), out: (addr handle cell), trace: (add
     return
   }
   var second-value/eax: (addr float) <- get second, number-data
-  var idx/eax: int <- convert *second-value
+  var idx/eax: int <- truncate *second-value
   # offset based on idx after bounds check
   var max/edx: int <- length array
   compare idx, max
   {
     break-if-<
-    error trace, "too few elements in array"
+    error trace, "iset: too few elements in array"
     return
   }
   var offset/edx: (offset handle cell) <- compute-offset array, idx