about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-26 02:42:30 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-26 02:42:30 -0800
commit1ea0b4e57922e5cb69193b5118b91a2a3da33d95 (patch)
treee8155fbb3b5fda2b22c1b4b1356feda4ca7a3776 /mu.arc
parentf9d8b661fb73281d3b8d844833134fcc8098fc2c (diff)
downloadmu-1ea0b4e57922e5cb69193b5118b91a2a3da33d95.tar.gz
627
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc8
1 files changed, 4 insertions, 4 deletions
diff --git a/mu.arc b/mu.arc
index 688fc012..d8b45205 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1019,14 +1019,14 @@
 
 (def new-scalar (type)
 ;?   (tr "new scalar: @type")
-  (ret result rep.routine*!alloc
-    (when (>= rep.routine*!alloc rep.routine*!alloc-max)
+  (let sz (sizeof `((_ ,type)))
+    (when (> sz (- rep.routine*!alloc-max rep.routine*!alloc))
       (let curr-alloc Memory-allocated-until
         (= rep.routine*!alloc curr-alloc)
         (++ Memory-allocated-until Allocation-chunk)
         (= rep.routine*!alloc-max Memory-allocated-until)))
-    (++ rep.routine*!alloc (sizeof `((_ ,type))))
-    ))
+    (ret result rep.routine*!alloc
+      (++ rep.routine*!alloc sz))))
 
 (def new-array (type size)
 ;?   (tr "new array: @type @size")