forked from suyu/suyu
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.
This commit is contained in:
parent
2d37ca3726
commit
fb5d4b17de
2 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue