Run clangformat everywhere

This commit is contained in:
SimoneN64
2024-08-27 21:35:07 +02:00
parent b3a4a302cb
commit e253627890
74 changed files with 5536 additions and 4358 deletions

View File

@@ -1,63 +1,50 @@
#pragma once
#include <queue>
#include <array>
#include <functional>
#include <log.hpp>
#include <queue>
namespace n64 {
struct Mem;
struct Registers;
}
} // namespace n64
enum EventType {
NONE,
PI_BUS_WRITE_COMPLETE,
PI_DMA_COMPLETE,
SI_DMA,
IMPOSSIBLE
};
enum EventType { NONE, PI_BUS_WRITE_COMPLETE, PI_DMA_COMPLETE, SI_DMA, IMPOSSIBLE };
struct Event {
u64 time;
EventType type;
friend bool operator<(const Event& rhs, const Event& lhs) {
return rhs.time < lhs.time;
}
friend bool operator<(const Event &rhs, const Event &lhs) { return rhs.time < lhs.time; }
friend bool operator>(const Event& rhs, const Event& lhs) {
return rhs.time > lhs.time;
}
friend bool operator>(const Event &rhs, const Event &lhs) { return rhs.time > lhs.time; }
friend bool operator>=(const Event& rhs, const Event& lhs) {
return rhs.time >= lhs.time;
}
friend bool operator>=(const Event &rhs, const Event &lhs) { return rhs.time >= lhs.time; }
};
struct IterableEvents {
std::priority_queue<Event, std::vector<Event>, std::greater<>> events;
public:
explicit IterableEvents() = default;
[[nodiscard]] auto top() const { return events.top(); }
auto pop() { events.pop(); }
[[nodiscard]] auto begin() const { return (Event*)(&events.top()); }
[[nodiscard]] auto begin() const { return (Event *)(&events.top()); }
[[nodiscard]] auto end() const { return begin() + events.size(); }
auto push(Event e) { events.push(e); }
};
struct Scheduler {
Scheduler() {
EnqueueAbsolute(std::numeric_limits<u64>::max(), IMPOSSIBLE);
}
Scheduler() { EnqueueAbsolute(std::numeric_limits<u64>::max(), IMPOSSIBLE); }
void EnqueueRelative(u64, EventType);
void EnqueueAbsolute(u64, EventType);
u64 Remove(EventType);
void Tick(u64 t, n64::Mem&);
void Tick(u64 t, n64::Mem &);
IterableEvents events;
u64 ticks = 0;
u8 index = 0;
};
extern Scheduler scheduler;
extern Scheduler scheduler;