From 38d2c8eb13b5317f77697e72574983d79a992353 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 5 Mar 2024 15:47:35 +0100 Subject: test/critter: fix it --- src/timer.hpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src') 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 - requires (std::is_same_v) - 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 + requires std::is_floating_point_v + 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; -- cgit v1.2.3