about summary refs log tree commit diff
path: root/aoc2019/IntCodeVM.cs
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-12-01 14:56:16 -0500
committerBen Harris <ben@tilde.team>2021-12-01 14:56:16 -0500
commitd56f59b19b137d068d2d89a7f680ff7dca4f0757 (patch)
tree61158cf2da9ca90c4e51d3d8764cac3a17b6467e /aoc2019/IntCodeVM.cs
parent212278cc640901f93b4d0bd1ffdccd6c67bfbac4 (diff)
fix some warnings and switch to target-type new()
Diffstat (limited to 'aoc2019/IntCodeVM.cs')
-rw-r--r--aoc2019/IntCodeVM.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/aoc2019/IntCodeVM.cs b/aoc2019/IntCodeVM.cs
index 74e433d..14d85c1 100644
--- a/aoc2019/IntCodeVM.cs
+++ b/aoc2019/IntCodeVM.cs
@@ -22,8 +22,8 @@ public class IntCodeVM
         relativeBase = 0;
         program = tape.Split(',').Select(long.Parse).ToArray();
         Memory = program;
-        input = new Queue<long>();
-        Output = new Queue<long>();
+        input = new();
+        Output = new();
     }
 
     public long Result => Output.Dequeue();
@@ -76,7 +76,7 @@ public class IntCodeVM
             0 => MemGet(param),
             1 => param,
             2 => MemGet(relativeBase + param),
-            _ => throw new Exception("invalid parameter mode")
+            _ => throw new("invalid parameter mode")
         };
     }
 
@@ -88,11 +88,11 @@ public class IntCodeVM
             case 0:
                 MemSet(param, val);
                 break;
-            case 1: throw new Exception("cannot set in immediate mode");
+            case 1: throw new("cannot set in immediate mode");
             case 2:
                 MemSet(relativeBase + param, val);
                 break;
-            default: throw new Exception("invalid parameter mode");
+            default: throw new("invalid parameter mode");
         }
     }
 
@@ -148,7 +148,7 @@ public class IntCodeVM
                 case 99:
                     return HaltType.Terminate;
                 default:
-                    throw new Exception($"unknown op {op} at {i}");
+                    throw new($"unknown op {op} at {i}");
             }
         }