#include <BigUnsignedInABase.hh>
|
typedef unsigned int | Index |
|
|
static const unsigned int | N |
|
Definition at line 32 of file BigUnsignedInABase.hh.
BigUnsignedInABase::BigUnsignedInABase |
( |
int |
, |
|
|
Index |
c |
|
) |
| |
|
inlineprotected |
BigUnsignedInABase::BigUnsignedInABase |
( |
| ) |
|
|
inline |
BigUnsignedInABase::BigUnsignedInABase |
( |
const Digit * |
d, |
|
|
Index |
l, |
|
|
Base |
base |
|
) |
| |
Definition at line 3 of file BigUnsignedInABase.cc.
7 throw "BigUnsignedInABase::BigUnsignedInABase(const Digit *, Index, Base): The base must be at least 2";
10 for (
Index i = 0; i < l; i++)
12 throw "BigUnsignedInABase::BigUnsignedInABase(const Digit *, Index, Base): A digit is too large for the specified base";
BigUnsignedInABase::~BigUnsignedInABase |
( |
| ) |
|
|
inline |
BigUnsignedInABase::BigUnsignedInABase |
( |
const BigUnsigned & |
x, |
|
|
Base |
base |
|
) |
| |
Definition at line 32 of file BigUnsignedInABase.cc.
35 throw "BigUnsignedInABase(BigUnsigned, Base): The base must be at least 2";
40 int minBitsPerDigit = bitLen(
base) - 1;
41 int maxDigitLenOfX = ceilingDiv(maxBitLenOfX, minBitsPerDigit);
48 while (!x2.isZero()) {
51 lastDigit.divideWithRemainder(buBase, x2);
53 blk[digitNum] = lastDigit.toUnsignedShort();
static const unsigned int N
BigUnsignedInABase::BigUnsignedInABase |
( |
const std::string & |
s, |
|
|
Base |
base |
|
) |
| |
Definition at line 73 of file BigUnsignedInABase.cc.
76 throw "BigUnsignedInABase(std::string, Base): The default string conversion routines use the symbol set 0-9, A-Z and therefore support only up to base 36. You tried a conversion with a base over 36; write your own string conversion routine.";
86 Index digitNum, symbolNumInString;
87 for (digitNum = 0; digitNum <
len; digitNum++) {
88 symbolNumInString = len - 1 - digitNum;
89 char theSymbol = s[symbolNumInString];
90 if (theSymbol >=
'0' && theSymbol <=
'9')
91 blk[digitNum] = theSymbol -
'0';
92 else if (theSymbol >=
'A' && theSymbol <=
'Z')
93 blk[digitNum] = theSymbol -
'A' + 10;
94 else if (theSymbol >=
'a' && theSymbol <=
'z')
95 blk[digitNum] = theSymbol -
'a' + 10;
97 throw "BigUnsignedInABase(std::string, Base): Bad symbol in input. Only 0-9, A-Z, a-z are accepted.";
100 throw "BigUnsignedInABase::BigUnsignedInABase(const Digit *, Index, Base): A digit is too large for the specified base";
Base BigUnsignedInABase::getBase |
( |
| ) |
const |
|
inline |
Digit BigUnsignedInABase::getDigit |
( |
Index |
i | ) |
const |
|
inline |
bool BigUnsignedInABase::isZero |
( |
| ) |
const |
|
inline |
Definition at line 62 of file BigUnsignedInABase.cc.
65 while (digitNum > 0) {
void multiply(const BigUnsigned &a, const BigUnsigned &b)
BigUnsignedInABase::operator std::string |
( |
| ) |
const |
Definition at line 105 of file BigUnsignedInABase.cc.
107 throw "BigUnsignedInABase ==> std::string: The default string conversion routines use the symbol set 0-9, A-Z and therefore support only up to base 36. You tried a conversion with a base over 36; write your own string conversion routine.";
109 return std::string(
"0");
111 char *s =
new char[
len + 1];
113 Index digitNum, symbolNumInString;
114 for (symbolNumInString = 0; symbolNumInString <
len; symbolNumInString++) {
115 digitNum = len - 1 - symbolNumInString;
118 s[symbolNumInString] = char(
'0' + theDigit);
120 s[symbolNumInString] = char(
'A' + theDigit - 10);
Definition at line 82 of file NumberlikeArray.hh.
bool operator==(const NumberlikeArray< unsigned short > &x) const
void BigUnsignedInABase::zapLeadingZeros |
( |
| ) |
|
|
inlineprotected |
Base BigUnsignedInABase::base |
|
protected |
The documentation for this class was generated from the following files: