diff options
author | Lioncash <mathew1800@gmail.com> | 2018-11-19 09:00:32 -0500 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-11-19 09:20:29 -0500 |
commit | fb5d4b17de035e3682e64513ae7612f40afd01bd (patch) | |
tree | ba3ea9eaad87f32b3844f4de0638df426000fdb9 /src | |
parent | 2d37ca372615e8e3e2a1feca07c1077dc4a001dd (diff) |
kernel/shared_memory: Add a const qualified member function overload for GetPointer()
Given this doesn't mutate instance state, we can provide a
const-qualified variant as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.h | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 68ad39fa1..b8bcc16ee 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -136,4 +136,8 @@ u8* SharedMemory::GetPointer(std::size_t offset) { return backing_block->data() + backing_block_offset + offset; } +const u8* SharedMemory::GetPointer(std::size_t offset) const { + return backing_block->data() + backing_block_offset + offset; +} + } // namespace Kernel diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 60433f09b..f3b05e48b 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -113,10 +113,17 @@ public: /** * Gets a pointer to the shared memory block * @param offset Offset from the start of the shared memory block to get pointer - * @return Pointer to the shared memory block from the specified offset + * @return A pointer to the shared memory block from the specified offset */ u8* GetPointer(std::size_t offset = 0); + /** + * Gets a constant pointer to the shared memory block + * @param offset Offset from the start of the shared memory block to get pointer + * @return A constant pointer to the shared memory block from the specified offset + */ + const u8* GetPointer(std::size_t offset = 0) const; + private: explicit SharedMemory(KernelCore& kernel); ~SharedMemory() override; |