lsst.sphgeom ga1cf026fa3+ac198e9f13
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lsst::sphgeom::BigInteger Class Reference

#include <BigInteger.h>

Public Member Functions

 BigInteger (uint32_t *digits, unsigned capacity)
 
BigIntegeroperator= (BigInteger const &b)
 
int getSign () const
 
unsigned getSize () const
 getSize returns the number of digits in the value of this integer.
 
unsigned getCapacity () const
 
uint32_t const * getDigits () const
 getDigits returns the underlying digit array.
 
void setToZero ()
 setToZero sets this integer to zero.
 
void setTo (int64_t x)
 setTo sets this integer to the given signed 64 bit integer value.
 
void setTo (uint64_t x)
 setTo sets this integer to the given unsigned 64 bit integer value.
 
void negate ()
 negate multiplies this integer by -1.
 
BigIntegeradd (BigInteger const &b)
 add adds b to this integer.
 
BigIntegersubtract (BigInteger const &b)
 subtract subtracts b from this integer.
 
BigIntegermultiplyPow2 (unsigned n)
 multiplyPow2 multiplies this integer by 2ⁿ.
 
BigIntegermultiply (BigInteger const &b)
 multiply multiplies this integer by b.
 

Detailed Description

BigInteger is an arbitrary precision signed integer class. It is intended to be used in applications which need relatively small integers, and only supports addition, subtraction and multiplication.

Internally, a BigInteger consists of a sign and an unsigned magnitude. The magnitude is represented by an array of 32 bit digits, stored from least to most significant. All non-zero integers have at least one digit, the most significant of which is non-zero. Zero is defined to have no digits.

Constructor & Destructor Documentation

◆ BigInteger()

lsst::sphgeom::BigInteger::BigInteger ( uint32_t *  digits,
unsigned  capacity 
)
inline

This constructor creates a zero-valued integer with the given digit array.

Member Function Documentation

◆ getCapacity()

unsigned lsst::sphgeom::BigInteger::getCapacity ( ) const
inline

getCapacity returns the number of digits in the underlying digit array.

◆ getSign()

int lsst::sphgeom::BigInteger::getSign ( ) const
inline

getSign returns -1, 0 or 1 if this integer is negative, zero or positive.


The documentation for this class was generated from the following files: