chore: modify type signature of util.sext
This commit is contained in:
@@ -9,7 +9,7 @@ pub fn format16(comptime cond: u4) InstrFn {
|
||||
return struct {
|
||||
fn inner(cpu: *Arm7tdmi, _: *Bus, opcode: u16) void {
|
||||
// B
|
||||
const offset = sext(8, opcode & 0xFF) << 1;
|
||||
const offset = sext(u32, u8, opcode & 0xFF) << 1;
|
||||
|
||||
const should_execute = switch (cond) {
|
||||
0xE, 0xF => cpu.panic("[CPU/THUMB.16] Undefined conditional branch with condition {}", .{cond}),
|
||||
@@ -27,7 +27,7 @@ pub fn format18() InstrFn {
|
||||
return struct {
|
||||
// B but conditional
|
||||
fn inner(cpu: *Arm7tdmi, _: *Bus, opcode: u16) void {
|
||||
const offset = sext(11, opcode & 0x7FF) << 1;
|
||||
const offset = sext(u32, u11, opcode & 0x7FF) << 1;
|
||||
cpu.r[15] = (cpu.r[15] + 2) +% offset;
|
||||
}
|
||||
}.inner;
|
||||
@@ -47,7 +47,7 @@ pub fn format19(comptime is_low: bool) InstrFn {
|
||||
cpu.r[14] = old_pc | 1;
|
||||
} else {
|
||||
// Instruction 1
|
||||
cpu.r[14] = (cpu.r[15] + 2) +% (sext(11, offset) << 12);
|
||||
cpu.r[14] = (cpu.r[15] + 2) +% (sext(u32, u11, offset) << 12);
|
||||
}
|
||||
}
|
||||
}.inner;
|
||||
|
Reference in New Issue
Block a user