mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 00:15:04 -05:00
Fixed unaligned memory read in DMI
This commit is contained in:
@@ -30,7 +30,7 @@ namespace xmrig {
|
||||
template<typename T>
|
||||
inline T readUnaligned(const T* ptr)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||
static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
|
||||
|
||||
T result;
|
||||
memcpy(&result, ptr, sizeof(T));
|
||||
@@ -41,7 +41,7 @@ inline T readUnaligned(const T* ptr)
|
||||
template<typename T>
|
||||
inline void writeUnaligned(T* ptr, T data)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||
static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
|
||||
|
||||
memcpy(ptr, &data, sizeof(T));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user