diff options
| author | 2021-02-08 18:01:40 -0800 | |
|---|---|---|
| committer | 2021-02-18 16:16:24 -0800 | |
| commit | 24e1e17a8ae3f2b2962b702d383abd19b57c7b05 (patch) | |
| tree | c5c37e8e3f4887a0791e7c57aa9699aeb9cce85c /src/core | |
| parent | common: alignment: Add DivideUp utility method. (diff) | |
| download | yuzu-24e1e17a8ae3f2b2962b702d383abd19b57c7b05.tar.gz yuzu-24e1e17a8ae3f2b2962b702d383abd19b57c7b05.tar.xz yuzu-24e1e17a8ae3f2b2962b702d383abd19b57c7b05.zip | |
core: memory: Add templated GetPointer methods.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/memory.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/memory.h b/src/core/memory.h index 705ebb23d..6d34fcfe2 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -116,6 +116,11 @@ public: | |||
| 116 | */ | 116 | */ |
| 117 | u8* GetPointer(VAddr vaddr); | 117 | u8* GetPointer(VAddr vaddr); |
| 118 | 118 | ||
| 119 | template <typename T> | ||
| 120 | T* GetPointer(VAddr vaddr) { | ||
| 121 | return reinterpret_cast<T*>(GetPointer(vaddr)); | ||
| 122 | } | ||
| 123 | |||
| 119 | /** | 124 | /** |
| 120 | * Gets a pointer to the given address. | 125 | * Gets a pointer to the given address. |
| 121 | * | 126 | * |
| @@ -126,6 +131,11 @@ public: | |||
| 126 | */ | 131 | */ |
| 127 | const u8* GetPointer(VAddr vaddr) const; | 132 | const u8* GetPointer(VAddr vaddr) const; |
| 128 | 133 | ||
| 134 | template <typename T> | ||
| 135 | const T* GetPointer(VAddr vaddr) const { | ||
| 136 | return reinterpret_cast<T*>(GetPointer(vaddr)); | ||
| 137 | } | ||
| 138 | |||
| 129 | /** | 139 | /** |
| 130 | * Reads an 8-bit unsigned value from the current process' address space | 140 | * Reads an 8-bit unsigned value from the current process' address space |
| 131 | * at the given virtual address. | 141 | * at the given virtual address. |