diff options
Diffstat (limited to 'number.h')
-rw-r--r-- | number.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -63,6 +63,14 @@ public: number operator<<(std::uint32_t n) const; /** + * \brief Return a number equals to this number where n bits have been + * shifted to the right. + * + * \param n Number of bits to shift. + */ + number operator>>(std::uint32_t) const; + + /** * \brief Tell whether the number passed as parameter is strictly less than * this number. * @@ -130,11 +138,26 @@ public: number &operator<<=(std::uint32_t); /** + * \brief Shift the number n bits to the right. + * + * \param n Number of bits to shift. + */ + number &operator>>=(std::uint32_t); + + /** * \brief Increment this number. */ number &operator++(); private: + /** + * \brief Remove unused leading 0 operands. + * + * Call this method after shrinking the number so that leading 0 operands + * are removed. + */ + void shrink_to_fit(); + /* First item is the least significant. */ std::list<std::uint32_t> _operands; }; |