fix: remove redundant casts from zig fmt

This commit is contained in:
2023-07-11 00:39:14 -05:00
parent a831ab22fe
commit 6c81608c59
13 changed files with 56 additions and 37 deletions

View File

@@ -58,6 +58,7 @@ pub fn Arm32(comptime arch: Architecture) type {
return self.stage[0] != null and self.stage[1] != null;
}
// TODO: Why does this not return T?
pub fn step(self: *@This(), cpu: *Self, comptime T: type) ?u32 {
comptime std.debug.assert(T == u32 or T == u16);
@@ -174,7 +175,7 @@ pub fn Arm32(comptime arch: Architecture) type {
}
pub fn setCpsr(self: *Self, value: u32) void {
if (value & 0x1F != self.cpsr.raw & 0x1F) self.changeModeFromIdx(@as(u5, @truncate(value & 0x1F)));
if (value & 0x1F != self.cpsr.raw & 0x1F) self.changeModeFromIdx(@truncate(value & 0x1F));
self.cpsr.raw = value;
}
@@ -267,12 +268,12 @@ pub fn Arm32(comptime arch: Architecture) type {
}
if (self.cpsr.t.read()) {
const opcode = @as(u16, @truncate(self.pipe.step(self, u16) orelse return));
const opcode: u16 = @truncate(self.pipe.step(self, u16) orelse return);
thumb.lut[thumb.idx(opcode)](self, self.bus, opcode);
} else {
const opcode = self.pipe.step(self, u32) orelse return;
if (self.cpsr.check(@as(u4, @truncate(opcode >> 28)))) {
if (self.cpsr.check(@truncate(opcode >> 28))) {
arm.lut[arm.idx(opcode)](self, self.bus, opcode);
}
}
@@ -391,7 +392,7 @@ pub const PSR = extern union {
}
pub inline fn check(self: @This(), cond: u4) bool {
const flags = @as(u4, @truncate(self.raw >> 28));
const flags: u4 = @truncate(self.raw >> 28);
return condition_lut[cond] & (@as(u16, 1) << flags) != 0;
}