Valhalla Legends Forums Archive | C/C++ Programming | c++ big integer class

AuthorMessageTime
K
I've lately revived some interest in my C++ big integer class, and iago was nice enough to lend me some space on his cvs.  If anyone else is interested in contributing, you can send me a forum message / AIM message.
The current interface looks like this:

[code]
class vlint
{

public:
vlint();
vlint(operations_t value);
vlint(signed int value);
vlint(const vlint& v);

// not yet implemented
//vlint(const char* value_str_rep);
//vlint(const unsigned char* byte_arr, std::size_t length)

vlint& operator=(const vlint& v);

vlint& operator++();
vlint& operator--();
vlint  operator++(int);
vlint  operator--(int);

bool operator==(const vlint& v) const;
bool operator!=(const vlint& v) const;
bool operator<(const vlint& v) const;
bool operator>(const vlint& v) const;

vlint operator+(const vlint& v) const;
vlint operator-(const vlint& v) const;
vlint operator*(const vlint& v) const;
vlint operator/(const vlint& v) const;
vlint divide(const vlint& right, vlint &remainder) const;

vlint operator%(const vlint& v) const;

vlint& operator+=(const vlint& v);
vlint& operator-=(const vlint& v);
vlint& operator*=(const vlint& v);
vlint& operator/=(const vlint& v);
vlint& operator%=(const vlint& v);

vlint operator-() const;

vlint operator|(const vlint& v) const;
vlint operator&(vlint v) const;
vlint operator^(const vlint& v) const;
vlint operator<<(int bits) const;
vlint operator>>(int bits) const;

vlint& operator|=(const vlint& v);
vlint& operator&=(const vlint& v);
vlint& operator^=(const vlint& v);
vlint& operator<<=(int bits);  
vlint& operator>>=(int bits);

vlint operator~() const;


friend std::ostream& operator<<(std::ostream& o, const vlint& v); // hack: outputs in hex
// not yet implemented
//friend std::istream& operator>>(std::istream& i, vlint& v);

};
[/code]

Everything that is not commented out is currently implemented and appears to work (I've done some testing, but not extensively).  Some of the code is very old and pretty shoddy and needs a complete re-write.  I'm looking for other people to help out, to get a new perspective.

/K

Edit: before you ask, the "vl" stands for variable length, not valhalla legends  ;)
October 20, 2004, 4:32 AM
Kp
[quote author=K link=topic=9244.msg85310#msg85310 date=1098246733]Edit: before you ask, the "vl" stands for variable length, not valhalla legends  ;)[/quote]

Ah.  I thought it was supposed to be v-lint, a clothing fuzz reference. :)
October 20, 2004, 5:57 AM
Zakath
Heh...that's also how I read it at first.
October 26, 2004, 4:11 AM

Search