We don't need heap allocation
This commit is contained in:
parent
c32fe79d4b
commit
9ad1671195
1 changed files with 7 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ const std = @import("std");
|
|||
|
||||
pub const title = "Day 04: Printing Department";
|
||||
|
||||
pub fn run(allocator: std.mem.Allocator) !void {
|
||||
pub fn run(_: std.mem.Allocator) !void {
|
||||
const initial_input = @embedFile("./input/day04.txt");
|
||||
//const initial_input =
|
||||
// \\..@@.@@@@.
|
||||
|
|
@ -17,9 +17,12 @@ pub fn run(allocator: std.mem.Allocator) !void {
|
|||
// \\@.@.@@@.@.
|
||||
// ;
|
||||
|
||||
const input = try allocator.alloc(u8, initial_input.len);
|
||||
defer allocator.free(input);
|
||||
@memcpy(input, initial_input);
|
||||
var input_buffer = comptime init: {
|
||||
var temp: [initial_input.len]u8 = undefined;
|
||||
@memcpy(&temp, initial_input);
|
||||
break :init temp;
|
||||
};
|
||||
const input: []u8 = &input_buffer;
|
||||
|
||||
var accumulator: u32 = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue