diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/timer.hpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/timer.hpp b/src/timer.hpp index 6e9bd651..36874e9e 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -60,18 +60,6 @@ struct Ns return Ns{(uint64_t)x}; } -#if 0 - template<typename T> - requires (std::is_same_v<T, double>) - static Ns from_nonzero(T seconds) - { - constexpr double max{uint64_t{1} << 53}; - fm_assert(seconds >= 0); - fm_assert(seconds <= max); - return Ns((uint64_t)seconds); - } -#endif - friend constexpr Ns operator+(const Ns& lhs, const Ns& rhs) { constexpr auto max = (uint64_t)-1; @@ -144,6 +132,19 @@ struct Ns return Ns{a / b}; } +#if 0 + template<typename T> + requires std::is_floating_point_v<T> + friend constexpr double operator/(const Ns& lhs, double b) + { + fm_assert(b != 0.); + auto x = double{lhs.stamp / b}; + constexpr auto max = double{uint64_t{1} << 53}; + fm_assert(x <= max); + return x; + } +#endif + friend constexpr uint64_t operator%(const Ns& lhs, const Ns& rhs) { auto a = lhs.stamp, b = rhs.stamp; |