Switch to i64 for words

This commit is contained in:
2019-12-09 10:48:40 +00:00
parent 96e35f265e
commit 289aa920d0
4 changed files with 55 additions and 54 deletions

View File

@@ -8,8 +8,8 @@ pub fn main() anyerror!void {
const alloc = &arena.allocator;
var p1 = try intcode.loadFromStdIn(alloc);
var p2 = try alloc.alloc(i32, p1.len);
std.mem.copy(i32, p2, p1);
var p2 = try alloc.alloc(intcode.Word, p1.len);
std.mem.copy(intcode.Word, p2, p1);
var m1 = try intcode.Machine.init(alloc, p1);
var m2 = try intcode.Machine.init(alloc, p2);
@@ -17,7 +17,7 @@ pub fn main() anyerror!void {
try m1.writeToInput(1); // Air conditioner unit
try m1.run();
var out: i32 = 0;
var out: intcode.Word = 0;
while (out == 0) : (out = try m1.readFromOutput()) {}
std.debug.warn("Day 5, Part 1: {}\n", out);