git.ucc.asn.au
/
ipdf
/
code.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Still-broken quadtree shenanigans!
[ipdf/code.git]
/
src
/
arbint.h
diff --git
a/src/arbint.h
b/src/arbint.h
index
06008e0
..
468785f
100644
(file)
--- a/
src/arbint.h
+++ b/
src/arbint.h
@@
-25,7
+25,7
@@
namespace IPDF
int64_t AsDigit() const
{
int64_t AsDigit() const
{
- int64_t digit = (m_digits.size() == 1) ? m_digits[0] : 0x
7FFFFFFFFFFFFFFF
;
+ int64_t digit = (m_digits.size() == 1) ? m_digits[0] : 0x
BADF00D
;
return (m_sign) ? -digit : digit;
}
return (m_sign) ? -digit : digit;
}
@@
-68,6
+68,13
@@
namespace IPDF
return a;
}
return a;
}
+ inline Arbint operator-() const
+ {
+ Arbint a(*this);
+ a.m_sign = !a.m_sign;
+ return a;
+ }
+
inline Arbint operator*(const Arbint & mul) const
{
Arbint a(*this);
inline Arbint operator*(const Arbint & mul) const
{
Arbint a(*this);
@@
-99,6
+106,7
@@
namespace IPDF
bool operator==(const Arbint & equ) const;
bool operator<(const Arbint & less) const;
bool operator==(const Arbint & equ) const;
bool operator<(const Arbint & less) const;
+
inline bool operator!=(const Arbint & equ) const
{
inline bool operator!=(const Arbint & equ) const
{
@@
-130,11
+138,11
@@
namespace IPDF
return result;
}
bool IsZero() const;
return result;
}
bool IsZero() const;
-
- inline operator double() const
+
+ inline operator double() const
{
double acc = 0;
{
double acc = 0;
- for(int i = m_digits.size()-1; i >= 0; --i)
+ for
(int i = m_digits.size()-1; i >= 0; --i)
{
acc += (double)m_digits[i];
acc *= (double)UINT64_MAX + 1.0;
{
acc += (double)m_digits[i];
acc *= (double)UINT64_MAX + 1.0;
@@
-153,6
+161,8
@@
namespace IPDF
Arbint & AddBasic(const Arbint & add);
Arbint & SubBasic(const Arbint & sub);
Arbint & AddBasic(const Arbint & add);
Arbint & SubBasic(const Arbint & sub);
+ void GrowDigit(digit_t new_msd); // add a new most significant digit
+
bool GetBit(unsigned i) const;
void BitClear(unsigned i);
void BitSet(unsigned i);
bool GetBit(unsigned i) const;
void BitClear(unsigned i);
void BitSet(unsigned i);
UCC
git Repository :: git.ucc.asn.au