From 604c2a843d95921e0429ebbdd5849174e47a9547 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 16 Jul 2026 17:30:17 +0200 Subject: kernel: begin block device re-architecture work --- libs/kstd/kstd/units.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libs/kstd') diff --git a/libs/kstd/kstd/units.hpp b/libs/kstd/kstd/units.hpp index df5eb374..6e9ea1e2 100644 --- a/libs/kstd/kstd/units.hpp +++ b/libs/kstd/kstd/units.hpp @@ -22,7 +22,8 @@ namespace kstd : value{value} {} - explicit constexpr operator value_type() const noexcept + template + explicit constexpr operator T() const noexcept { return value; } @@ -47,7 +48,7 @@ namespace kstd return *this = *this - other; } - constexpr auto operator*(std::integral auto factor) noexcept -> basic_unit + constexpr auto operator*(std::integral auto factor) const noexcept -> basic_unit { return basic_unit{value * factor}; } @@ -57,7 +58,7 @@ namespace kstd return *this = *this * factor; } - constexpr auto operator/(std::integral auto divisor) noexcept -> basic_unit + constexpr auto operator/(std::integral auto divisor) const noexcept -> basic_unit { return basic_unit{value / divisor}; } @@ -72,6 +73,11 @@ namespace kstd return value / other.value; } + constexpr auto operator%(basic_unit const & other) const noexcept -> basic_unit + { + return basic_unit{value % other.value}; + } + constexpr auto operator<=>(basic_unit const & other) const noexcept -> std::strong_ordering = default; value_type value; -- cgit v1.2.3