Fixed unaligned memory read in DMI
This commit is contained in:
parent
c877ba8145
commit
285719cde4
3 changed files with 6 additions and 6 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue