From f09f814dc3da03f8a10164360b6d867535aed6c6 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sun, 2 Jan 2022 13:19:09 -0600 Subject: [PATCH] chore: move bitfield library to lib director I'd presonally prefer to use a git submodule here but It doesn't quite seem like git submodules are possible for individual files. I'll have to check with FlorenceOS every once and a while to ensure that there are no lingering soundness issues with the library. Thanks to @N00byEdge for this wonderful library! --- build.zig | 4 ++++ {src => lib}/util/bitfield.zig | 2 -- src/cpu.zig | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) rename {src => lib}/util/bitfield.zig (97%) diff --git a/build.zig b/build.zig index 9e83445..dc9af7d 100644 --- a/build.zig +++ b/build.zig @@ -12,6 +12,10 @@ pub fn build(b: *std.build.Builder) void { const mode = b.standardReleaseOptions(); const exe = b.addExecutable("zba", "src/main.zig"); + + // Bitfield type from FlorenceOS: https://github.com/FlorenceOS/ + exe.addPackage(.{ .name = "bitfield", .path = .{ .path = "./lib/util/bitfield.zig" } }); + exe.setTarget(target); exe.setBuildMode(mode); exe.install(); diff --git a/src/util/bitfield.zig b/lib/util/bitfield.zig similarity index 97% rename from src/util/bitfield.zig rename to lib/util/bitfield.zig index 7253dc3..1124cd2 100644 --- a/src/util/bitfield.zig +++ b/lib/util/bitfield.zig @@ -1,5 +1,3 @@ -// source + credit: https://github.com/FlorenceOS/Florence/blob/master/lib/util/bitfields.zig -- - const std = @import("std"); fn PtrCastPreserveCV(comptime T: type, comptime PtrToT: type, comptime NewT: type) type { diff --git a/src/cpu.zig b/src/cpu.zig index e6844d7..9b7cee1 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -1,6 +1,6 @@ const std = @import("std"); const util = @import("util.zig"); -const bitfield = @import("util/bitfield.zig"); +const bitfield = @import("bitfield"); const Bus = @import("bus.zig").Bus; const Scheduler = @import("scheduler.zig").Scheduler;