From 4e9dcd1697948f581be0f85c6d6d6670c61c09f5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Mar 2024 11:41:53 +0100 Subject: remove Ns multiplication with single-precision floats --- src/nanosecond.hpp | 1 - src/nanosecond.inl | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/src/nanosecond.hpp b/src/nanosecond.hpp index 94c30ba3..cd5f1eec 100644 --- a/src/nanosecond.hpp +++ b/src/nanosecond.hpp @@ -21,7 +21,6 @@ struct Ns template requires (std::is_integral_v && std::is_unsigned_v) friend constexpr Ns operator*(const Ns& lhs, T rhs); template requires (std::is_integral_v && std::is_signed_v && sizeof(T) < sizeof(uint64_t)) friend constexpr Ns operator*(const Ns&, T); template friend constexpr Ns operator*(T lhs, const Ns& rhs); - template requires std::is_same_v friend constexpr Ns operator*(const Ns& lhs, T rhs); friend constexpr uint64_t operator/(const Ns& lhs, const Ns& rhs); friend constexpr Ns operator/(const Ns& lhs, uint64_t b); diff --git a/src/nanosecond.inl b/src/nanosecond.inl index 6527dc02..5f93a409 100644 --- a/src/nanosecond.inl +++ b/src/nanosecond.inl @@ -60,18 +60,6 @@ constexpr Ns operator*(T lhs, const Ns& rhs) return rhs * lhs; } -template -requires std::is_same_v -constexpr Ns operator*(const Ns& lhs, T rhs) -{ - constexpr float max{uint64_t{1} << 24}; - auto a = lhs.stamp; - auto x = float(a) * float{rhs}; - fm_assert(x >= 0); - fm_assert(x <= max); - return Ns{uint64_t(x)}; -} - constexpr uint64_t operator/(const Ns& lhs, const Ns& rhs) { auto a = lhs.stamp, b = rhs.stamp; -- cgit v1.2.3