继续做一些小的inline,大头的话,还是要动这个scheduler

This commit is contained in:
root 2024-05-10 11:03:58 +08:00
parent e403d94364
commit c2cff2cc78
2 changed files with 9 additions and 9 deletions

View File

@ -13,7 +13,7 @@
namespace nba {
template<typename T>
T read(void const* data, uint offset) {
inline T read(void const* data, uint offset) {
T value;
std::memcpy(&value, (u8*)data + offset, sizeof(T));
return value;

View File

@ -249,6 +249,14 @@ private:
static constexpr int LeftChild(int n) { return n * 2 + 1; }
static constexpr int RightChild(int n) { return n * 2 + 2; }
void ALWAYS_INLINE Swap(int i, int j) {
auto tmp = heap[i];
heap[i] = heap[j];
heap[j] = tmp;
heap[i]->handle = i;
heap[j]->handle = j;
}
void Step(u64 timestamp_next) {
while(heap[0]->timestamp <= timestamp_next && heap_size > 0) {
auto event = heap[0];
@ -273,14 +281,6 @@ private:
}
}
void Swap(int i, int j) {
auto tmp = heap[i];
heap[i] = heap[j];
heap[j] = tmp;
heap[i]->handle = i;
heap[j]->handle = j;
}
void Heapify(int n) {
int l = LeftChild(n);
int r = RightChild(n);