chore: simply some zig fmt builtin changes

This commit is contained in:
2023-07-17 01:07:18 -05:00
parent d96c9c01ff
commit d4b7167e29
22 changed files with 587 additions and 589 deletions

View File

@@ -76,14 +76,14 @@ pub fn sound4CntL(self: *const Self) u16 {
/// NR41, NR42
pub fn setSound4CntL(self: *Self, value: u16) void {
self.setNr41(@as(u8, @truncate(value)));
self.setNr42(@as(u8, @truncate(value >> 8)));
self.setNr41(@truncate(value));
self.setNr42(@truncate(value >> 8));
}
/// NR41
pub fn setNr41(self: *Self, len: u8) void {
self.len = @as(u6, @truncate(len));
self.len_dev.timer = @as(u7, 64) - @as(u6, @truncate(len));
self.len = @truncate(len);
self.len_dev.timer = @as(u7, 64) - self.len;
}
/// NR42
@@ -99,8 +99,8 @@ pub fn sound4CntH(self: *const Self) u16 {
/// NR43, NR44
pub fn setSound4CntH(self: *Self, fs: *const FrameSequencer, value: u16) void {
self.poly.raw = @as(u8, @truncate(value));
self.setNr44(fs, @as(u8, @truncate(value >> 8)));
self.poly.raw = @truncate(value);
self.setNr44(fs, @truncate(value >> 8));
}
/// NR44

View File

@@ -77,8 +77,8 @@ pub fn sound2CntL(self: *const Self) u16 {
/// NR21, NR22
pub fn setSound2CntL(self: *Self, value: u16) void {
self.setNr21(@as(u8, @truncate(value)));
self.setNr22(@as(u8, @truncate(value >> 8)));
self.setNr21(@truncate(value));
self.setNr22(@truncate(value >> 8));
}
/// NR21
@@ -100,8 +100,8 @@ pub fn sound2CntH(self: *const Self) u16 {
/// NR23, NR24
pub fn setSound2CntH(self: *Self, fs: *const FrameSequencer, value: u16) void {
self.setNr23(@as(u8, @truncate(value)));
self.setNr24(fs, @as(u8, @truncate(value >> 8)));
self.setNr23(@truncate(value));
self.setNr24(fs, @truncate(value >> 8));
}
/// NR23

View File

@@ -81,8 +81,8 @@ pub fn onToneSweepEvent(self: *Self, late: u64) void {
/// NR10, NR11, NR12
pub fn setSound1Cnt(self: *Self, value: u32) void {
self.setSound1CntL(@as(u8, @truncate(value)));
self.setSound1CntH(@as(u16, @truncate(value >> 16)));
self.setSound1CntL(@truncate(value));
self.setSound1CntH(@truncate(value >> 16));
}
/// NR10
@@ -111,8 +111,8 @@ pub fn sound1CntH(self: *const Self) u16 {
/// NR11, NR12
pub fn setSound1CntH(self: *Self, value: u16) void {
self.setNr11(@as(u8, @truncate(value)));
self.setNr12(@as(u8, @truncate(value >> 8)));
self.setNr11(@truncate(value));
self.setNr12(@truncate(value >> 8));
}
/// NR11
@@ -134,8 +134,8 @@ pub fn sound1CntX(self: *const Self) u16 {
/// NR13, NR14
pub fn setSound1CntX(self: *Self, fs: *const FrameSequencer, value: u16) void {
self.setNr13(@as(u8, @truncate(value)));
self.setNr14(fs, @as(u8, @truncate(value >> 8)));
self.setNr13(@truncate(value));
self.setNr14(fs, @truncate(value >> 8));
}
/// NR13

View File

@@ -64,8 +64,8 @@ pub fn tick(self: *Self, comptime kind: Tick) void {
/// NR30, NR31, NR32
pub fn setSound3Cnt(self: *Self, value: u32) void {
self.setSound3CntL(@as(u8, @truncate(value)));
self.setSound3CntH(@as(u16, @truncate(value >> 16)));
self.setSound3CntL(@truncate(value));
self.setSound3CntH(@truncate(value >> 16));
}
/// NR30
@@ -86,8 +86,8 @@ pub fn sound3CntH(self: *const Self) u16 {
/// NR31, NR32
pub fn setSound3CntH(self: *Self, value: u16) void {
self.setNr31(@as(u8, @truncate(value)));
self.vol.raw = (@as(u8, @truncate(value >> 8)));
self.setNr31(@truncate(value));
self.vol.raw = @truncate(value >> 8);
}
/// NR31
@@ -98,8 +98,8 @@ pub fn setNr31(self: *Self, len: u8) void {
/// NR33, NR34
pub fn setSound3CntX(self: *Self, fs: *const FrameSequencer, value: u16) void {
self.setNr33(@as(u8, @truncate(value)));
self.setNr34(fs, @as(u8, @truncate(value >> 8)));
self.setNr33(@truncate(value));
self.setNr34(fs, @truncate(value >> 8));
}
/// NR33, NR34

View File

@@ -29,7 +29,7 @@ pub fn tick(self: *Self, ch1: *ToneSweep) void {
if (new_freq <= 0x7FF and ch1.sweep.shift.read() != 0) {
ch1.freq.frequency.write(@as(u11, @truncate(new_freq)));
self.shadow = @as(u11, @truncate(new_freq));
self.shadow = @truncate(new_freq);
_ = self.calculate(ch1.sweep, &ch1.enabled);
}

View File

@@ -70,7 +70,7 @@ pub fn sample(self: *const Self, nr30: io.WaveSelect) u4 {
const base = if (nr30.bank.read()) @as(u32, 0x10) else 0;
const value = self.buf[base + self.offset / 2];
return if (self.offset & 1 == 0) @as(u4, @truncate(value >> 4)) else @as(u4, @truncate(value));
return if (self.offset & 1 == 0) @truncate(value >> 4) else @truncate(value);
}
/// TODO: Write comment