-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtask_node.cpp
More file actions
33 lines (23 loc) · 777 Bytes
/
task_node.cpp
File metadata and controls
33 lines (23 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "task_node.hpp"
#include "abstract_task.hpp"
namespace cosche
{
TaskNode::TaskNode(AbstractTask* task) : _task(task) {}
TaskNode::operator AbstractTask*() const { return _task; }
bool operator==(const TaskNode& lhs,
const TaskNode& rhs)
{
return (lhs._task->id() == rhs._task->id());
}
std::size_t TaskNodeHasher::operator()(const TaskNode& n) const
{
const std::size_t id = n._task->id();
const std::size_t base = 0x00000100000001b3;
std::size_t hash = 0xcbf29ce484222325;
hash = (hash ^ ((id << 0x00) + (id >> 0x20))) * base;
hash = (hash ^ ((id << 0x08) + (id >> 0x18))) * base;
hash = (hash ^ ((id << 0x10) + (id >> 0x10))) * base;
hash = (hash ^ ((id << 0x18) + (id >> 0x08))) * base;
return hash;
}
}