fix: remove redundant casts from zig fmt
This commit is contained in:
@@ -33,6 +33,8 @@ pub fn fmt78(comptime InstrFn: type, comptime op: u2, comptime T: bool) InstrFn
|
||||
switch (op) {
|
||||
0b00 => {
|
||||
// STRH
|
||||
|
||||
// FIXME: I shouldn't have to use @as(u8, ...) here
|
||||
bus.write(u16, address, @as(u16, @truncate(cpu.r[rd])));
|
||||
},
|
||||
0b01 => {
|
||||
@@ -47,6 +49,8 @@ pub fn fmt78(comptime InstrFn: type, comptime op: u2, comptime T: bool) InstrFn
|
||||
0b11 => {
|
||||
// LDRSH
|
||||
const value = bus.read(u16, address);
|
||||
|
||||
// FIXME: I shouldn't have to use @as(u8, ...) here
|
||||
cpu.r[rd] = if (address & 1 == 1) sext(u32, u8, @as(u8, @truncate(value >> 8))) else sext(u32, u16, value);
|
||||
},
|
||||
}
|
||||
@@ -59,6 +63,8 @@ pub fn fmt78(comptime InstrFn: type, comptime op: u2, comptime T: bool) InstrFn
|
||||
},
|
||||
0b01 => {
|
||||
// STRB
|
||||
|
||||
// FIXME: I shouldn't have to use @as(u8, ...) here
|
||||
bus.write(u8, address, @as(u8, @truncate(cpu.r[rd])));
|
||||
},
|
||||
0b10 => {
|
||||
@@ -99,6 +105,8 @@ pub fn fmt9(comptime InstrFn: type, comptime B: bool, comptime L: bool, comptime
|
||||
if (B) {
|
||||
// STRB
|
||||
const address = cpu.r[rb] + offset;
|
||||
|
||||
// FIXME: I shouldn't have to use @as(u8, ...) here
|
||||
bus.write(u8, address, @as(u8, @truncate(cpu.r[rd])));
|
||||
} else {
|
||||
// STR
|
||||
@@ -126,6 +134,8 @@ pub fn fmt10(comptime InstrFn: type, comptime L: bool, comptime offset: u5) Inst
|
||||
cpu.r[rd] = rotr(u32, value, 8 * (address & 1));
|
||||
} else {
|
||||
// STRH
|
||||
|
||||
// FIXME: I shouldn't have to use @as(u8, ...) here
|
||||
bus.write(u16, address, @as(u16, @truncate(cpu.r[rd])));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user