From 8bbf7b2d31609bd4e9aea47dace9d63879df14da Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 26 Oct 2021 20:10:22 -0300 Subject: [PATCH] chore: ensure consistency across project --- src/cpu.zig | 7 +++---- src/scheduler.zig | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cpu.zig b/src/cpu.zig index bb07bd0..2b27bb1 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -233,11 +233,11 @@ fn execute(cpu: *Cpu, display: *Display, mem: *[0x1000]u8, instr: Instruction) v }, .LD_DT_Vx => |x| { const when = scheduler.now() + OPS_PER_HZ * @as(u64, cpu.v[x]); - scheduler.ReplaceOrPush(EventKind.DelayTimer, when); + scheduler.replaceOrPush(EventKind.DelayTimer, when); }, .LD_ST_Vx => |x| { const when = scheduler.now() + OPS_PER_HZ * @as(u64, cpu.v[x]); - scheduler.ReplaceOrPush(EventKind.SoundTimer, when); + scheduler.replaceOrPush(EventKind.SoundTimer, when); }, .ADD_I_Vx => |x| { const sum: u16 = cpu.i + cpu.v[x]; @@ -248,8 +248,7 @@ fn execute(cpu: *Cpu, display: *Display, mem: *[0x1000]u8, instr: Instruction) v cpu.i = 0x50 + (5 * cpu.v[x]); }, .LD_B_Vx => |x| { - var value = cpu.v[x]; - + const value = cpu.v[x]; mem[cpu.i] = value / 100; mem[cpu.i + 1] = (value / 10) % 10; mem[cpu.i + 2] = value % 10; diff --git a/src/scheduler.zig b/src/scheduler.zig index 794c2ac..62a2ca5 100644 --- a/src/scheduler.zig +++ b/src/scheduler.zig @@ -38,7 +38,7 @@ pub const Scheduler = struct { self.pushEvent(Event{ .kind = kind, .timestamp = when }); } - pub fn ReplaceOrPush(self: *Scheduler, kind: EventKind, when: u64) void { + pub fn replaceOrPush(self: *Scheduler, kind: EventKind, when: u64) void { if (self.find(kind)) |event| { self.queue.update(event, Event{ .kind = kind, .timestamp = when }) catch unreachable; } else {