From 5fced73f46b846bfab7cb8d03edbf8bd694096a9 Mon Sep 17 00:00:00 2001 From: Madeline Busig Date: Fri, 2 Aug 2024 22:07:04 -0600 Subject: [PATCH] Add fixed point number unary negation operator --- include/mtl/fixed.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/mtl/fixed.hpp b/include/mtl/fixed.hpp index ab536de..090daa2 100644 --- a/include/mtl/fixed.hpp +++ b/include/mtl/fixed.hpp @@ -117,6 +117,9 @@ public: constexpr fixed operator-(fixed rhs) const { return from_raw(x - rhs.x); } + constexpr fixed operator-() const { + return from_raw(-x); + } /** * \brief Fixed point multiplication