more inlined stuff

This commit is contained in:
SimoneN64
2023-06-06 10:59:25 +02:00
parent be7f1fc5a0
commit 8fb0dd826d
3 changed files with 17 additions and 20 deletions

View File

@@ -3,19 +3,3 @@
#include <core/registers/Registers.hpp> #include <core/registers/Registers.hpp>
Scheduler scheduler; Scheduler scheduler;
void Scheduler::enqueueRelative(const Event& event) {
enqueueAbsolute({event.time + ticks, event.handler});
}
void Scheduler::enqueueAbsolute(const Event& e) {
events.push(e);
}
void Scheduler::tick(u64 t, n64::Mem& mem, n64::Registers& regs) {
ticks += t;
while(ticks >= events.top().time) {
events.top().handler(mem, regs);
events.pop();
}
}

View File

@@ -32,9 +32,22 @@ struct Scheduler {
Util::panic("How the fuck did we get here?!"); Util::panic("How the fuck did we get here?!");
}}); }});
} }
void enqueueRelative(const Event&);
void enqueueAbsolute(const Event&); FORCE_INLINE void enqueueRelative(const Event& event) {
void tick(u64, n64::Mem&, n64::Registers&); enqueueAbsolute({event.time + ticks, event.handler});
}
FORCE_INLINE void enqueueAbsolute(const Event& e) {
events.push(e);
}
FORCE_INLINE void tick(u64 t, n64::Mem& mem, n64::Registers& regs) {
ticks += t;
while(ticks >= events.top().time) {
events.top().handler(mem, regs);
events.pop();
}
}
std::priority_queue<Event, std::vector<Event>, std::greater<>> events; std::priority_queue<Event, std::vector<Event>, std::greater<>> events;
u64 ticks = 0; u64 ticks = 0;
u8 index = 0; u8 index = 0;

View File

@@ -101,7 +101,7 @@ private:
u8* sram; u8* sram;
u8 isviewer[ISVIEWER_SIZE]{}; u8 isviewer[ISVIEWER_SIZE]{};
bool IsROMPAL() { FORCE_INLINE bool IsROMPAL() {
static const char pal_codes[] = {'D', 'F', 'I', 'P', 'S', 'U', 'X', 'Y'}; static const char pal_codes[] = {'D', 'F', 'I', 'P', 'S', 'U', 'X', 'Y'};
return std::any_of(std::begin(pal_codes), std::end(pal_codes), [this](char a) { return std::any_of(std::begin(pal_codes), std::end(pal_codes), [this](char a) {
return rom.cart[0x3d] == a; return rom.cart[0x3d] == a;