From 5a2d18587b53133bc831967ccd8d6a5dd6e54190 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 19 Nov 2017 11:51:41 +0100 Subject: Added the left-shift computation Signed-off-by: Olivier Gayot --- number.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'number.h') diff --git a/number.h b/number.h index d93ed70..16fcea6 100644 --- a/number.h +++ b/number.h @@ -48,6 +48,14 @@ public: */ number operator*(const number &) const; + /** + * \brief Return a number equals to this number where n bits have been + * shifted to the left. + * + * \param n Number of bits to shift. + */ + number operator<<(std::uint32_t n) const; + /** * \brief Tells whether the number passed as parameter is strictly less * than this number. @@ -103,6 +111,13 @@ public: */ number &operator+=(const number &n); + /** + * \brief Shift the number n bits to the left. + * + * \param n Number of bits to shift. + */ + number &operator<<=(std::uint32_t); + /** * \brief Increment this number. */ -- cgit v1.2.3