summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-11-23 19:14:04 +0100
committerLioncash <mathew1800@gmail.com>2022-11-23 19:15:19 +0100
commit59335f6796480f6b98f981cbb672cdb112a8a3f8 (patch)
tree7d891e48cd9a8d30ecc0d35e9a4990d5376c0497 /src/core/hle/kernel
parenthle_ipc: Mark relevant member functions as [[nodiscard]] (diff)
downloadyuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar.gz
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar.bz2
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar.lz
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar.xz
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.tar.zst
yuzu-59335f6796480f6b98f981cbb672cdb112a8a3f8.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index d68ea5b1e..e252b5f4b 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -313,6 +313,18 @@ public:
/// Helper function to get the size of the output buffer
[[nodiscard]] std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
+ /// Helper function to derive the number of elements able to be contained in the read buffer
+ template <typename T>
+ [[nodiscard]] std::size_t GetReadBufferNumElements(std::size_t buffer_index = 0) const {
+ return GetReadBufferSize(buffer_index) / sizeof(T);
+ }
+
+ /// Helper function to derive the number of elements able to be contained in the write buffer
+ template <typename T>
+ [[nodiscard]] std::size_t GetWriteBufferNumElements(std::size_t buffer_index = 0) const {
+ return GetWriteBufferSize(buffer_index) / sizeof(T);
+ }
+
/// Helper function to test whether the input buffer at buffer_index can be read
[[nodiscard]] bool CanReadBuffer(std::size_t buffer_index = 0) const;