Skip to content

Commit 34386c9

Browse files
committed
GPU: Fix alignment violation
1 parent 6de69a4 commit 34386c9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

GPU/GPUTracking/utils/strtag.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ constexpr T qStr2Tag(const char* str)
2323
if (strlen(str) != sizeof(T)) {
2424
throw std::runtime_error("Invalid tag length");
2525
}
26-
return *(T*)str;
26+
T tmp;
27+
for (unsigned int i = 0; i < sizeof(T); i++) {
28+
((char*)&tmp)[i] = str[i];
29+
}
30+
return tmp;
2731
}
2832

2933
template <class T>

0 commit comments

Comments
 (0)