diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2023-10-11 14:43:50 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2023-10-11 14:43:50 +0200 |
| commit | 74eaee0fcc7390d4290b41a2a92ee34346e2f7c2 (patch) | |
| tree | 3a38f8dbe0c6b757167bc264cb68e3da145bd069 /source/include | |
| parent | f47bee5f51a73593d3594940663f56f2427f480b (diff) | |
| download | teachos-74eaee0fcc7390d4290b41a2a92ee34346e2f7c2.tar.xz teachos-74eaee0fcc7390d4290b41a2a92ee34346e2f7c2.zip | |
teachos: restructure file layout
Diffstat (limited to 'source/include')
| -rw-r--r-- | source/include/memory/asm_pointer.hpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/include/memory/asm_pointer.hpp b/source/include/memory/asm_pointer.hpp new file mode 100644 index 0000000..ec7141e --- /dev/null +++ b/source/include/memory/asm_pointer.hpp @@ -0,0 +1,43 @@ +#ifndef TEACHOS_BOOT_ASM_POINTER_HPP +#define TEACHOS_BOOT_ASM_POINTER_HPP + +namespace teachos::boot +{ + + template<typename Type> + struct asm_pointer + { + constexpr asm_pointer(Type & pointer) + : m_pointer{&pointer} + { + } + + auto constexpr operator->() -> Type * { return m_pointer; } + auto constexpr operator->() const -> Type const * { return m_pointer; } + auto constexpr operator*() -> Type & { return *m_pointer; } + auto constexpr operator*() const -> Type const & { return *m_pointer; } + + private: + Type * m_pointer; + }; + + template<typename Type> + struct asm_pointer<Type const> + { + constexpr asm_pointer(Type const & pointer) + : m_pointer{&pointer} + { + } + + auto constexpr operator->() -> Type const * { return m_pointer; } + auto constexpr operator->() const -> Type const * { return m_pointer; } + auto constexpr operator*() -> Type const & { return *m_pointer; } + auto constexpr operator*() const -> Type const & { return *m_pointer; } + + private: + Type const * m_pointer; + }; + +} // namespace teachos::boot + +#endif
\ No newline at end of file |
