From 6beca4c34506edfc51cb3fd9cd3a2e895d6932e0 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 27 Nov 2017 11:16:46 +0100 Subject: Added the multiplication assignment operator Signed-off-by: Olivier Gayot --- number.cpp | 8 ++++++++ number.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/number.cpp b/number.cpp index 074c4dc..02d655d 100644 --- a/number.cpp +++ b/number.cpp @@ -315,6 +315,14 @@ number::operator+=(const number &n) return *this; } +number & +number::operator*=(const number &n) +{ + *this = *this * n; + + return *this; +} + number & number::operator<<=(std::uint32_t n) { diff --git a/number.h b/number.h index d0d2a10..07df60f 100644 --- a/number.h +++ b/number.h @@ -139,6 +139,13 @@ public: */ number &operator+=(const number &n); + /** + * \brief Multiply a number with this number. + * + * \param n Number with multiply to this number. + */ + number &operator*=(const number &n); + /** * \brief Shift the number n bits to the left. * -- cgit v1.2.3