diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 04f771928..873b0bcd2 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -2869,8 +2869,7 @@ static int heap_take_snapshot() for (auto i : entries) { - uintptr_t val = 0; - memcpy(&val, &i.first, sizeof(void*)); + uintptr_t val = reinterpret_cast(i.first); snapshot[val] = i.second; } @@ -2890,14 +2889,6 @@ static int heap_take_snapshot() return 0; } -static void* address_to_pointer(uintptr_t ptr) -{ - void* as_ptr = nullptr; - memcpy((void*)&as_ptr, &ptr, sizeof(uintptr_t)); - - return as_ptr; -} - //this function probably should not allocate. Then again we're shimming through lua which.... probably does static int get_heap_state() { @@ -2981,7 +2972,7 @@ static uintptr_t get_root_address_of_heap_object(uintptr_t ptr) static int msize_address(uintptr_t ptr) { #ifdef _WIN32 - void* vptr = address_to_pointer(ptr); + void* vptr = reinterpret_cast(ptr); if (vptr) return _msize(vptr);