From 357211a4ccfa98e6ba216290e28a199e076e03e6 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:52 -0300 Subject: [PATCH] chore: remove premature inlines --- src/bus/Bios.zig | 6 +++--- src/bus/GamePak.zig | 6 +++--- src/cpu.zig | 2 +- src/cpu/barrel_shifter.zig | 6 +++--- src/ppu.zig | 20 ++++++++++---------- src/scheduler.zig | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bus/Bios.zig b/src/bus/Bios.zig index 4785894..0c98efe 100644 --- a/src/bus/Bios.zig +++ b/src/bus/Bios.zig @@ -22,17 +22,17 @@ pub fn deinit(self: Self) void { self.alloc.free(self.buf); } -pub inline fn get32(self: *const Self, idx: usize) u32 { +pub fn get32(self: *const Self, idx: usize) u32 { std.debug.panic("[BIOS] TODO: BIOS is not implemented", .{}); return (@as(u32, self.buf[idx + 3]) << 24) | (@as(u32, self.buf[idx + 2]) << 16) | (@as(u32, self.buf[idx + 1]) << 8) | (@as(u32, self.buf[idx])); } -pub inline fn get16(self: *const Self, idx: usize) u16 { +pub fn get16(self: *const Self, idx: usize) u16 { std.debug.panic("[BIOS] TODO: BIOS is not implemented", .{}); return (@as(u16, self.buf[idx + 1]) << 8) | @as(u16, self.buf[idx]); } -pub inline fn get8(self: *const Self, idx: usize) u8 { +pub fn get8(self: *const Self, idx: usize) u8 { std.debug.panic("[BIOS] TODO: BIOS is not implemented", .{}); return self.buf[idx]; } diff --git a/src/bus/GamePak.zig b/src/bus/GamePak.zig index 0d851b3..e7a49b3 100644 --- a/src/bus/GamePak.zig +++ b/src/bus/GamePak.zig @@ -22,14 +22,14 @@ pub fn deinit(self: Self) void { self.alloc.free(self.buf); } -pub inline fn get32(self: *const Self, idx: usize) u32 { +pub fn get32(self: *const Self, idx: usize) u32 { return (@as(u32, self.get16(idx + 2)) << 16) | @as(u32, self.get16(idx)); } -pub inline fn get16(self: *const Self, idx: usize) u16 { +pub fn get16(self: *const Self, idx: usize) u16 { return (@as(u16, self.buf[idx + 1]) << 8) | @as(u16, self.buf[idx]); } -pub inline fn get8(self: *const Self, idx: usize) u8 { +pub fn get8(self: *const Self, idx: usize) u8 { return self.buf[idx]; } diff --git a/src/cpu.zig b/src/cpu.zig index ae61306..6d2f84a 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -45,7 +45,7 @@ pub const Arm7tdmi = struct { self.cpsr.raw = 0x6000001F; } - pub inline fn step(self: *Self) u64 { + pub fn step(self: *Self) u64 { const opcode = self.fetch(); // self.mgbaLog(opcode); diff --git a/src/cpu/barrel_shifter.zig b/src/cpu/barrel_shifter.zig index 49611cc..d2bb272 100644 --- a/src/cpu/barrel_shifter.zig +++ b/src/cpu/barrel_shifter.zig @@ -3,7 +3,7 @@ const std = @import("std"); const Arm7tdmi = @import("../cpu.zig").Arm7tdmi; const CPSR = @import("../cpu.zig").CPSR; -pub inline fn exec(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 { +pub fn exec(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 { var shift_amt: u8 = undefined; if (opcode >> 4 & 1 == 1) { shift_amt = @truncate(u8, cpu.r[opcode >> 8 & 0xF]); @@ -31,7 +31,7 @@ pub inline fn exec(comptime S: bool, cpu: *Arm7tdmi, opcode: u32) u32 { } } -pub inline fn logical_left(cpsr: *CPSR, rm: u32, shift_byte: u8) u32 { +pub fn logical_left(cpsr: *CPSR, rm: u32, shift_byte: u8) u32 { const shift_amt = @truncate(u5, shift_byte); const bit_count: u8 = @typeInfo(u32).Int.bits; @@ -58,7 +58,7 @@ pub inline fn logical_left(cpsr: *CPSR, rm: u32, shift_byte: u8) u32 { return result; } -pub inline fn logical_right(cpsr: *CPSR, rm: u32, shift_byte: u8) u32 { +pub fn logical_right(cpsr: *CPSR, rm: u32, shift_byte: u8) u32 { const shift_amt = @truncate(u5, shift_byte); const bit_count: u8 = @typeInfo(u32).Int.bits; diff --git a/src/ppu.zig b/src/ppu.zig index 3db2db5..3a59544 100644 --- a/src/ppu.zig +++ b/src/ppu.zig @@ -72,25 +72,25 @@ const Palette = struct { self.alloc.free(self.buf); } - pub inline fn get32(self: *const Self, idx: usize) u32 { + pub fn get32(self: *const Self, idx: usize) u32 { return (@as(u32, self.get16(idx + 2)) << 16) | @as(u32, self.get16(idx)); } - pub inline fn set32(self: *Self, idx: usize, word: u32) void { + pub fn set32(self: *Self, idx: usize, word: u32) void { self.set16(idx + 2, @truncate(u16, word >> 16)); self.set16(idx, @truncate(u16, word)); } - pub inline fn get16(self: *const Self, idx: usize) u16 { + pub fn get16(self: *const Self, idx: usize) u16 { return (@as(u16, self.buf[idx + 1]) << 8) | @as(u16, self.buf[idx]); } - pub inline fn set16(self: *Self, idx: usize, halfword: u16) void { + pub fn set16(self: *Self, idx: usize, halfword: u16) void { self.buf[idx + 1] = @truncate(u8, halfword >> 8); self.buf[idx] = @truncate(u8, halfword); } - pub inline fn get8(self: *const Self, idx: usize) u8 { + pub fn get8(self: *const Self, idx: usize) u8 { return self.buf[idx]; } }; @@ -112,25 +112,25 @@ const Vram = struct { self.alloc.free(self.buf); } - pub inline fn get32(self: *const Self, idx: usize) u32 { + pub fn get32(self: *const Self, idx: usize) u32 { return (@as(u32, self.get16(idx + 2)) << 16) | @as(u32, self.get16(idx)); } - pub inline fn set32(self: *Self, idx: usize, word: u32) void { + pub fn set32(self: *Self, idx: usize, word: u32) void { self.set16(idx + 2, @truncate(u16, word >> 16)); self.set16(idx, @truncate(u16, word)); } - pub inline fn get16(self: *const Self, idx: usize) u16 { + pub fn get16(self: *const Self, idx: usize) u16 { return (@as(u16, self.buf[idx + 1]) << 8) | @as(u16, self.buf[idx]); } - pub inline fn set16(self: *Self, idx: usize, halfword: u16) void { + pub fn set16(self: *Self, idx: usize, halfword: u16) void { self.buf[idx + 1] = @truncate(u8, halfword >> 8); self.buf[idx] = @truncate(u8, halfword); } - pub inline fn get8(self: *const Self, idx: usize) u8 { + pub fn get8(self: *const Self, idx: usize) u8 { return self.buf[idx]; } }; diff --git a/src/scheduler.zig b/src/scheduler.zig index 0247dc5..0718942 100644 --- a/src/scheduler.zig +++ b/src/scheduler.zig @@ -84,11 +84,11 @@ pub const Scheduler = struct { } } - pub inline fn push(self: *Self, kind: EventKind, end: u64) void { + pub fn push(self: *Self, kind: EventKind, end: u64) void { self.queue.add(.{ .kind = kind, .tick = end }) catch unreachable; } - pub inline fn nextTimestamp(self: *Self) u64 { + pub fn nextTimestamp(self: *Self) u64 { if (self.queue.peek()) |e| { return e.tick; } else unreachable;