From d24ab714b958b9fece4631076e240739ad0dd23f Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 3 Oct 2016 22:15:25 +0200 Subject: Progress --- bigint.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bigint.h') diff --git a/bigint.h b/bigint.h index 6579054..213bf5c 100644 --- a/bigint.h +++ b/bigint.h @@ -39,6 +39,9 @@ public: Bigint& operator+=(const Bigint&); Bigint& operator-=(const Bigint&); Bigint& operator*=(const Bigint&); + Bigint& operator+=(slongdigit_t); + Bigint& operator-=(slongdigit_t); + Bigint& operator*=(slongdigit_t); Bigint& operator<<=(int); Bigint& operator>>=(int); Bigint& negate(); @@ -46,9 +49,12 @@ public: Bigint operator+(const Bigint&) const; Bigint operator-(const Bigint&) const; Bigint operator*(const Bigint&) const; + Bigint operator+(slongdigit_t) const; + Bigint operator-(slongdigit_t) const; + Bigint operator*(slongdigit_t) const; Bigint operator<<(int) const; Bigint operator>>(int) const; - std::pair divmod(const Bigint&) const; + std::pair divmod(const Bigint&) const; //rounds towards zero; returns {quotient,remainder} bool operator==(const Bigint&) const; bool operator!=(const Bigint&) const; @@ -70,6 +76,8 @@ public: int bitcount() const; slongdigit_t lowdigits() const; + bool even() const; + bool odd() const; std::vector serialise() const; void deserialise(const std::vector&); @@ -79,9 +87,12 @@ public: friend std::ostream& operator<<(std::ostream&,Bigint); digit_t _digit(int idx) const; -}; -Bigint pow(const Bigint &b,const Bigint &ex); + + static Bigint zero; + static Bigint one; + static Bigint mone; +}; std::istream& operator>>(std::istream&,Bigint&); std::ostream& operator<<(std::ostream&,Bigint); -- cgit v1.2.3-70-g09d2