This commit is contained in:
Nekotekina
2016-01-14 20:13:41 +03:00
parent 960668ecf1
commit 2f5be3559e
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ namespace vm
// Convert pointer-to-member to a vm address compatible offset
template<typename MT, typename T> inline u32 get_offset(MT T::*const member_ptr)
{
return static_cast<u32>(reinterpret_cast<std::uintptr_t>(&(reinterpret_cast<T*>(0ull)->*member_ptr)));
return static_cast<u32>(reinterpret_cast<std::uintptr_t>(&reinterpret_cast<char const volatile&>(reinterpret_cast<T*>(0ull)->*member_ptr)));
}
template<typename T> struct cast_ptr
+1 -1
View File
@@ -176,7 +176,7 @@ constexpr u32 size32(const T(&)[Size])
}
// return 32 bit offsetof()
#define OFFSET_32(type, x) static_cast<u32>(reinterpret_cast<uintptr_t>(&(reinterpret_cast<type*>(0ull)->x)))
#define OFFSET_32(type, x) static_cast<u32>(reinterpret_cast<uintptr_t>(&reinterpret_cast<char const volatile&>(reinterpret_cast<type*>(0ull)->x)))
#define CONCATENATE_DETAIL(x, y) x ## y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)