From b6119a55f9bbc306593afccc0820165d74c2fadc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 18 Oct 2022 15:33:47 -0400 Subject: fixed_point: Mark copy/move assignment operators and constructors as constexpr Given these are just moving a raw value around, these can sensibly be made constexpr to make the interface more useful. --- src/common/fixed_point.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index ad0d71e50..5aafa273b 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h @@ -268,9 +268,12 @@ public: public: // constructors FixedPoint() = default; - FixedPoint(const FixedPoint&) = default; - FixedPoint(FixedPoint&&) noexcept = default; - FixedPoint& operator=(const FixedPoint&) = default; + + constexpr FixedPoint(const FixedPoint&) = default; + constexpr FixedPoint& operator=(const FixedPoint&) = default; + + constexpr FixedPoint(FixedPoint&&) noexcept = default; + constexpr FixedPoint& operator=(FixedPoint&&) noexcept = default; template constexpr FixedPoint(Number n) : data_(static_cast(n * one)) {} -- cgit v1.2.3