diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-10-29 15:01:43 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-10-29 15:01:43 +0100 |
| commit | b157e2c472d8bd67ac1656404a6a6ee821260f4b (patch) | |
| tree | 9c4ebaee21c9ad3521f86c543dc1f29906305baa /kapi | |
| parent | c2b0bdfe3b725166f16c742cdaca7969052df382 (diff) | |
| download | teachos-b157e2c472d8bd67ac1656404a6a6ee821260f4b.tar.xz teachos-b157e2c472d8bd67ac1656404a6a6ee821260f4b.zip | |
chore: reformat source code
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/include/kapi/memory/address.hpp | 18 | ||||
| -rw-r--r-- | kapi/include/kapi/memory/frame.hpp | 20 | ||||
| -rw-r--r-- | kapi/src/cio.cpp | 20 |
3 files changed, 38 insertions, 20 deletions
diff --git a/kapi/include/kapi/memory/address.hpp b/kapi/include/kapi/memory/address.hpp index 585807a..63301aa 100644 --- a/kapi/include/kapi/memory/address.hpp +++ b/kapi/include/kapi/memory/address.hpp @@ -20,20 +20,24 @@ namespace teachos::memory { constexpr explicit address(std::uintptr_t value) noexcept : m_value{value} - { - } + {} explicit address(std::byte * pointer) noexcept : m_value{std::bit_cast<std::uintptr_t>(pointer)} + {} + + explicit operator std::byte *() const noexcept { + return std::bit_cast<std::byte *>(m_value); } - explicit operator std::byte *() const noexcept { return std::bit_cast<std::byte *>(m_value); } + constexpr auto operator<=>(address const &) const noexcept -> std::strong_ordering = default; + constexpr auto operator==(address const &) const noexcept -> bool = default; - auto constexpr operator<=>(address const &) const noexcept -> std::strong_ordering = default; - auto constexpr operator==(address const &) const noexcept -> bool = default; - - auto constexpr raw() const noexcept -> std::uintptr_t { return m_value; } + constexpr auto raw() const noexcept -> std::uintptr_t + { + return m_value; + } private: std::uintptr_t m_value{}; diff --git a/kapi/include/kapi/memory/frame.hpp b/kapi/include/kapi/memory/frame.hpp index 8bcf79f..a208f28 100644 --- a/kapi/include/kapi/memory/frame.hpp +++ b/kapi/include/kapi/memory/frame.hpp @@ -19,8 +19,7 @@ namespace teachos::memory explicit constexpr frame(std::size_t number) : m_number{number} - { - } + {} /** * @brief Returns the physical frame the given address is contained in. @@ -28,7 +27,7 @@ namespace teachos::memory * @param address Physical address we want to get the corresponding physical frame for. * @return Frame the given address is contained in. */ - auto constexpr static containing(physical_address address) noexcept -> frame + constexpr auto static containing(physical_address address) noexcept -> frame { return frame{address.raw() / PLATFORM_FRAME_SIZE}; } @@ -38,7 +37,7 @@ namespace teachos::memory * * @return Start address of the physical frame. */ - auto constexpr start_address() const noexcept -> physical_address + constexpr auto start_address() const noexcept -> physical_address { return physical_address{m_number * PLATFORM_FRAME_SIZE}; } @@ -49,14 +48,17 @@ namespace teachos::memory * @param offset * @return A new frame n frames after this one. */ - auto constexpr operator+(std::size_t n) const noexcept -> frame { return frame{m_number + n}; } + constexpr auto operator+(std::size_t n) const noexcept -> frame + { + return frame{m_number + n}; + } /** * @brief Increment this frame to refer to the next one, returning a copy. * * @return Copy of the incremented underlying frame number. */ - auto constexpr operator++(int) noexcept -> frame + constexpr auto operator++(int) noexcept -> frame { auto copy = *this; ++*this; @@ -68,7 +70,7 @@ namespace teachos::memory * * @return Reference to the incremented underlying frame number. */ - auto constexpr operator++() noexcept -> frame & + constexpr auto operator++() noexcept -> frame & { ++m_number; return *this; @@ -77,12 +79,12 @@ namespace teachos::memory /** * @brief Check if this frame refers to the same frame as @p other. */ - auto constexpr operator==(frame const & other) const noexcept -> bool = default; + constexpr auto operator==(frame const & other) const noexcept -> bool = default; /** * @brief Lexicographically compare this frame to @p other. */ - auto constexpr operator<=>(frame const & other) const noexcept -> std::strong_ordering = default; + constexpr auto operator<=>(frame const & other) const noexcept -> std::strong_ordering = default; private: std::size_t m_number{}; diff --git a/kapi/src/cio.cpp b/kapi/src/cio.cpp index aa26d49..e8490e9 100644 --- a/kapi/src/cio.cpp +++ b/kapi/src/cio.cpp @@ -18,12 +18,24 @@ namespace teachos::cio return std::exchange(active_device, &device); } - auto print(std::string_view text) -> void { active_device->write(text); } + auto print(std::string_view text) -> void + { + active_device->write(text); + } - auto println(std::string_view text) -> void { active_device->writeln(text); } + auto println(std::string_view text) -> void + { + active_device->writeln(text); + } - auto print_error(std::string_view text) -> void { active_device->write_error(text); } + auto print_error(std::string_view text) -> void + { + active_device->write_error(text); + } - auto println_error(std::string_view text) -> void { active_device->writeln_error(text); } + auto println_error(std::string_view text) -> void + { + active_device->writeln_error(text); + } } // namespace teachos::cio
\ No newline at end of file |
