chore: introduce zba-util

In an effort to reuse code between zba and zba-gdbstub, move common util
code (like the SPSC Channel I implemented in this commit) in a new lib
This commit is contained in:
2023-03-10 00:05:31 -06:00
parent 72b702cb21
commit 11eae091db
19 changed files with 28 additions and 128 deletions

View File

@@ -14,7 +14,6 @@ const SoundFifo = std.fifo.LinearFifo(u8, .{ .Static = 0x20 });
const getHalf = util.getHalf;
const setHalf = util.setHalf;
const intToBytes = util.intToBytes;
const log = std.log.scoped(.APU);
@@ -557,7 +556,7 @@ pub fn DmaSound(comptime kind: DmaSoundKind) type {
pub fn push(self: *Self, value: u32) void {
if (!self.enabled) self.enable();
self.fifo.write(&intToBytes(u32, value)) catch |e| log.err("{} Error: {}", .{ kind, e });
self.fifo.write(std.mem.asBytes(&value)) catch |e| log.err("{} Error: {}", .{ kind, e });
}
fn enable(self: *Self) void {