summaryrefslogtreecommitdiff
path: root/2019
diff options
context:
space:
mode:
Diffstat (limited to '2019')
-rw-r--r--2019/IntCode.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/2019/IntCode.hs b/2019/IntCode.hs
index 1730dfd..0729e0f 100644
--- a/2019/IntCode.hs
+++ b/2019/IntCode.hs
@@ -149,7 +149,7 @@ runArray arr ptr inp offset = do
(_, right) <- SA.getBounds arr1
if idx < right
then return arr1
- else SA.getElems arr1 >>= \els -> SA.newListArray (0, 2 * idx) (els ++ replicate (idx - right + 1) 0)
+ else SA.getElems arr1 >>= \els -> SA.newListArray (0, 2 * idx) (els ++ replicate (2 * idx - right) 0)
performWrite arr1 idx value = do
arr' <- resize arr1 (fromIntegral idx)
SA.writeArray arr' (fromIntegral idx) value