Dota2Patcher
 
Загрузка...
Поиск...
Не найдено
CHandle.h
См. документацию.
1#pragma once
2
3constexpr int HANDLE_INDEX_MASK = 0x1FFF; // 13 bit index
4constexpr int HANDLE_SERIAL_SHIFT = 13; // 14+ bit == serial number
5
6class CHandle {
7public:
8 explicit CHandle(uint32_t handle = 0) : m_handle(handle) {}
9
10 uint32_t to_index() const {
11 return m_handle & HANDLE_INDEX_MASK;
12 }
13
14 uint32_t to_serial() const {
15 return m_handle >> HANDLE_SERIAL_SHIFT;
16 }
17
18 uint32_t get() const {
19 return m_handle;
20 }
21
22 bool operator==(const CHandle& other) const {
23 return m_handle == other.m_handle;
24 }
25
26 bool operator!=(const CHandle& other) const {
27 return m_handle != other.m_handle;
28 }
29
30private:
31 uint32_t m_handle;
32};
constexpr int HANDLE_SERIAL_SHIFT
Definition CHandle.h:4
constexpr int HANDLE_INDEX_MASK
Definition CHandle.h:3
Definition CHandle.h:6
bool operator!=(const CHandle &other) const
Definition CHandle.h:26
bool operator==(const CHandle &other) const
Definition CHandle.h:22
uint32_t get() const
Definition CHandle.h:18
uint32_t to_serial() const
Definition CHandle.h:14
uint32_t to_index() const
Definition CHandle.h:10
CHandle(uint32_t handle=0)
Definition CHandle.h:8