chore: run zig fmt

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-12-29 15:13:50 -06:00
parent ff7bf4eaa7
commit 7cc3f40a85
4 changed files with 13 additions and 17 deletions

View File

@ -130,9 +130,6 @@ const Mode = enum(u5) {
System = 0b11111, System = 0b11111,
}; };
fn undefined_instr(_: *ARM7TDMI, _: *Bus, opcode: u32) void { fn undefined_instr(_: *ARM7TDMI, _: *Bus, opcode: u32) void {
const id = armIdx(opcode); const id = armIdx(opcode);
std.debug.panic("[0x{X:}] 0x{X:} is an illegal opcode", .{ id, opcode }); std.debug.panic("[0x{X:}] 0x{X:} is an illegal opcode", .{ id, opcode });

View File

@ -46,7 +46,7 @@ pub fn comptimeHalfSignedDataTransfer(comptime P: bool, comptime U: bool, compti
// LDRSH // LDRSH
const halfword = bus.readHalfWord(address); const halfword = bus.readHalfWord(address);
cpu.r[rd] = util.u32_sign_extend(@as(u32, halfword), 16); cpu.r[rd] = util.u32_sign_extend(@as(u32, halfword), 16);
} },
} }
} else { } else {
if (opcode >> 5 & 0x01 == 0x01) { if (opcode >> 5 & 0x01 == 0x01) {

View File

@ -1,6 +1,5 @@
const std = @import("std"); const std = @import("std");
pub fn u32_sign_extend(value: u32, bitSize: anytype) u32 { pub fn u32_sign_extend(value: u32, bitSize: anytype) u32 {
const amount: u5 = 32 - bitSize; const amount: u5 = 32 - bitSize;
return @bitCast(u32, @bitCast(i32, value << amount) >> amount); return @bitCast(u32, @bitCast(i32, value << amount) >> amount);