23 #ifndef LSST_SPHGEOM_BIGINTEGER_H_ 24 #define LSST_SPHGEOM_BIGINTEGER_H_ 58 _checkCapacity(b._size);
61 std::memcpy(_digits, b._digits,
sizeof(uint32_t) * b._size);
71 unsigned getSize()
const {
return _size; }
78 uint32_t
const *
getDigits()
const {
return _digits; }
86 setTo(static_cast<uint64_t>(-x));
89 setTo(static_cast<uint64_t>(x));
96 _digits[0] =
static_cast<uint32_t
>(
x);
97 _digits[1] =
static_cast<uint32_t
>(x >> 32);
98 _size = (_digits[1] == 0) ? (_digits[0] != 0) : 2;
119 void _checkCapacity(
unsigned n)
const {
133 #endif // LSST_SPHGEOM_BIGINTEGER_H_ BigInteger & multiply(BigInteger const &b)
multiply multiplies this integer by b.
BigInteger & operator=(BigInteger const &b)
void setTo(int64_t x)
setTo sets this integer to the given signed 64 bit integer value.
unsigned getCapacity() const
getCapacity returns the number of digits in the underlying digit array.
void negate()
negate multiplies this integer by -1.
uint32_t const * getDigits() const
getDigits returns the underlying digit array.
BigInteger & multiplyPow2(unsigned n)
multiplyPow2 multiplies this integer by 2ⁿ.
BigInteger is an arbitrary precision signed integer class.
unsigned getSize() const
getSize returns the number of digits in the value of this integer.
A base class for image defects.
void setToZero()
setToZero sets this integer to zero.
int getSign() const
getSign returns -1, 0 or 1 if this integer is negative, zero or positive.
BigInteger(uint32_t *digits, unsigned capacity)
This constructor creates a zero-valued integer with the given digit array.
void setTo(uint64_t x)
setTo sets this integer to the given unsigned 64 bit integer value.
BigInteger & subtract(BigInteger const &b)
subtract subtracts b from this integer.
BigInteger & add(BigInteger const &b)
add adds b to this integer.