1
0
Fork 0
forked from suyu/suyu

memory/slab_heap: Make use of static_cast over reinterpret_cast

Casting from void* with static_cast is permitted by the standard, so we
can just make use of that instead.
This commit is contained in:
Lioncash 2020-04-17 19:38:57 -04:00
parent b8f5c71f2d
commit 7e585bce28

View file

@ -51,7 +51,7 @@ public:
} }
void Free(void* obj) { void Free(void* obj) {
Node* node = reinterpret_cast<Node*>(obj); Node* node = static_cast<Node*>(obj);
Node* cur_head = head.load(); Node* cur_head = head.load();
do { do {
@ -145,7 +145,7 @@ public:
} }
T* Allocate() { T* Allocate() {
T* obj = reinterpret_cast<T*>(AllocateImpl()); T* obj = static_cast<T*>(AllocateImpl());
if (obj != nullptr) { if (obj != nullptr) {
new (obj) T(); new (obj) T();
} }