summaryrefslogtreecommitdiffstats
path: root/src/core/hle/ipc_helpers.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-08-05 20:08:26 +0200
committerLioncash <mathew1800@gmail.com>2020-08-05 20:08:28 +0200
commita77ee63f65ba34d91944e168a9ba29464cef12b1 (patch)
tree707a3dfb4ed17b20f297ada3767f86e1b6fba319 /src/core/hle/ipc_helpers.h
parentMerge pull request #4466 from ogniK5377/loader-type-safe (diff)
downloadyuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar.gz
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar.bz2
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar.lz
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar.xz
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.tar.zst
yuzu-a77ee63f65ba34d91944e168a9ba29464cef12b1.zip
Diffstat (limited to 'src/core/hle/ipc_helpers.h')
-rw-r--r--src/core/hle/ipc_helpers.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 0dc6a4a43..1b503331f 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -229,6 +229,8 @@ inline void ResponseBuilder::Push(u32 value) {
template <typename T>
void ResponseBuilder::PushRaw(const T& value) {
+ static_assert(std::is_trivially_copyable_v<T>,
+ "It's undefined behavior to use memcpy with non-trivially copyable objects");
std::memcpy(cmdbuf + index, &value, sizeof(T));
index += (sizeof(T) + 3) / 4; // round up to word length
}
@@ -384,6 +386,8 @@ inline s32 RequestParser::Pop() {
template <typename T>
void RequestParser::PopRaw(T& value) {
+ static_assert(std::is_trivially_copyable_v<T>,
+ "It's undefined behavior to use memcpy with non-trivially copyable objects");
std::memcpy(&value, cmdbuf + index, sizeof(T));
index += (sizeof(T) + 3) / 4; // round up to word length
}