Add shared util.zig file
This commit is contained in:
parent
510ff33dd7
commit
0947abe4f4
26 changed files with 63 additions and 50 deletions
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day01.txt");
|
const data = @embedFile("../data/day01.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day02.txt");
|
const data = @embedFile("../data/day02.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day03.txt");
|
const data = @embedFile("../data/day03.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day04.txt");
|
const data = @embedFile("../data/day04.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day05.txt");
|
const data = @embedFile("../data/day05.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day06.txt");
|
const data = @embedFile("../data/day06.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day07.txt");
|
const data = @embedFile("../data/day07.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day08.txt");
|
const data = @embedFile("../data/day08.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day09.txt");
|
const data = @embedFile("../data/day09.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day10.txt");
|
const data = @embedFile("../data/day10.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day11.txt");
|
const data = @embedFile("../data/day11.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day12.txt");
|
const data = @embedFile("../data/day12.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day13.txt");
|
const data = @embedFile("../data/day13.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day14.txt");
|
const data = @embedFile("../data/day14.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day15.txt");
|
const data = @embedFile("../data/day15.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day16.txt");
|
const data = @embedFile("../data/day16.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day17.txt");
|
const data = @embedFile("../data/day17.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day18.txt");
|
const data = @embedFile("../data/day18.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day19.txt");
|
const data = @embedFile("../data/day19.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day20.txt");
|
const data = @embedFile("../data/day20.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day21.txt");
|
const data = @embedFile("../data/day21.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day22.txt");
|
const data = @embedFile("../data/day22.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day23.txt");
|
const data = @embedFile("../data/day23.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day24.txt");
|
const data = @embedFile("../data/day24.txt");
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ const HashMap = std.AutoHashMap;
|
||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const BitSet = std.DynamicBitSet;
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
const util = @import("util.zig");
|
||||||
const gpa = &gpa_impl.allocator;
|
const gpa = util.gpa;
|
||||||
|
|
||||||
const data = @embedFile("../data/day25.txt");
|
const data = @embedFile("../data/day25.txt");
|
||||||
|
|
||||||
|
|
13
src/util.zig
Normal file
13
src/util.zig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const std = @import("std");
|
||||||
|
const Allocator = std.mem.Allocator;
|
||||||
|
const assert = std.debug.assert;
|
||||||
|
const print = std.debug.print;
|
||||||
|
const ArrayList = std.ArrayList;
|
||||||
|
const HashMap = std.AutoHashMap;
|
||||||
|
const StringHashMap = std.StringHashMap;
|
||||||
|
const BitSet = std.DynamicBitSet;
|
||||||
|
|
||||||
|
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
|
pub const gpa = &gpa_impl.allocator;
|
||||||
|
|
||||||
|
// Add utility functions here
|
Loading…
Reference in a new issue