继续做一些小的inline,大头的话,还是要动这个scheduler
This commit is contained in:
parent
e403d94364
commit
c2cff2cc78
@ -13,7 +13,7 @@
|
|||||||
namespace nba {
|
namespace nba {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T read(void const* data, uint offset) {
|
inline T read(void const* data, uint offset) {
|
||||||
T value;
|
T value;
|
||||||
std::memcpy(&value, (u8*)data + offset, sizeof(T));
|
std::memcpy(&value, (u8*)data + offset, sizeof(T));
|
||||||
return value;
|
return value;
|
||||||
|
@ -249,6 +249,14 @@ private:
|
|||||||
static constexpr int LeftChild(int n) { return n * 2 + 1; }
|
static constexpr int LeftChild(int n) { return n * 2 + 1; }
|
||||||
static constexpr int RightChild(int n) { return n * 2 + 2; }
|
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) {
|
void Step(u64 timestamp_next) {
|
||||||
while(heap[0]->timestamp <= timestamp_next && heap_size > 0) {
|
while(heap[0]->timestamp <= timestamp_next && heap_size > 0) {
|
||||||
auto event = heap[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) {
|
void Heapify(int n) {
|
||||||
int l = LeftChild(n);
|
int l = LeftChild(n);
|
||||||
int r = RightChild(n);
|
int r = RightChild(n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user