| 1 | /* |
| 2 | * Matt McCutchen's Big Integer Library |
| 3 | * http://mysite.verizon.net/mccutchen/bigint/ |
| 4 | */ |
| 5 | |
| 6 | #ifndef BIGINTEGERUTILS |
| 7 | #define BIGINTEGERUTILS |
| 8 | |
| 9 | #include "BigInteger.hh" |
| 10 | #include <string> |
| 11 | #include <iostream> |
| 12 | |
| 13 | /* |
| 14 | * This file includes: |
| 15 | * (1) `std::string <=> BigUnsigned/BigInteger' conversion routines easier than `BigUnsignedInABase' |
| 16 | * (2) << and >> operators for BigUnsigned/BigInteger, std::istream/std::ostream |
| 17 | */ |
| 18 | |
| 19 | // Conversion routines. Base 10 only. |
| 20 | std::string easyBUtoString(const BigUnsigned &x); |
| 21 | std::string easyBItoString(const BigInteger &x); |
| 22 | BigUnsigned easyStringToBU(const std::string &s); |
| 23 | BigInteger easyStringToBI(const std::string &s); |
| 24 | |
| 25 | // Outputs x to os, obeying the flags `dec', `hex', `bin', and `showbase'. |
| 26 | std::ostream &operator <<(std::ostream &os, const BigUnsigned &x); |
| 27 | |
| 28 | // Outputs x to os, obeying the flags `dec', `hex', `bin', and `showbase'. |
| 29 | // My somewhat arbitrary policy: a negative sign comes before a base indicator (like -0xFF). |
| 30 | std::ostream &operator <<(std::ostream &os, const BigInteger &x); |
| 31 | |
| 32 | #endif |