LSST Applications 28.0.2,g0fba68d861+5b923b673a,g1fd858c14a+7a7b9dd5ed,g2c84ff76c0+5548bfee71,g30358e5240+f0e04ebe90,g35bb328faa+fcb1d3bbc8,g436fd98eb5+bdc6fcdd04,g4af146b050+742274f7cd,g4d2262a081+3efd3f8190,g4e0f332c67+cb09b8a5b6,g53246c7159+fcb1d3bbc8,g5a012ec0e7+477f9c599b,g5edb6fd927+826dfcb47f,g60b5630c4e+bdc6fcdd04,g67b6fd64d1+2218407a0c,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+f9ac2ab1bd,g8852436030+ebf28f0d95,g89139ef638+2218407a0c,g9125e01d80+fcb1d3bbc8,g989de1cb63+2218407a0c,g9f33ca652e+42fb53f4c8,g9f7030ddb1+11b9b6f027,ga2b97cdc51+bdc6fcdd04,gab72ac2889+bdc6fcdd04,gabe3b4be73+1e0a283bba,gabf8522325+3210f02652,gb1101e3267+9c79701da9,gb58c049af0+f03b321e39,gb89ab40317+2218407a0c,gcf25f946ba+ebf28f0d95,gd6cbbdb0b4+e8f9c9c900,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+a08f294619,ge278dab8ac+3ef3db156b,ge410e46f29+2218407a0c,gf67bdafdda+2218407a0c
LSST Data Management Base Package
|
BigInteger
is an arbitrary precision signed integer class.
More...
#include <BigInteger.h>
Public Member Functions | |
BigInteger (std::uint32_t *digits, unsigned capacity) | |
This constructor creates a zero-valued integer with the given digit array. | |
BigInteger & | operator= (BigInteger const &b) |
int | getSign () const |
getSign returns -1, 0 or 1 if this integer is negative, zero or positive. | |
unsigned | getSize () const |
getSize returns the number of digits in the value of this integer. | |
unsigned | getCapacity () const |
getCapacity returns the number of digits in the underlying digit array. | |
std::uint32_t const * | getDigits () const |
getDigits returns the underlying digit array. | |
void | setToZero () |
setToZero sets this integer to zero. | |
void | setTo (std::int64_t x) |
setTo sets this integer to the given signed 64 bit integer value. | |
void | setTo (std::uint64_t x) |
setTo sets this integer to the given unsigned 64 bit integer value. | |
void | negate () |
negate multiplies this integer by -1. | |
BigInteger & | add (BigInteger const &b) |
add adds b to this integer. | |
BigInteger & | subtract (BigInteger const &b) |
subtract subtracts b from this integer. | |
BigInteger & | multiplyPow2 (unsigned n) |
multiplyPow2 multiplies this integer by 2ⁿ. | |
BigInteger & | multiply (BigInteger const &b) |
multiply multiplies this integer by b. | |
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.
Definition at line 51 of file BigInteger.h.
|
inline |
This constructor creates a zero-valued integer with the given digit array.
Definition at line 55 of file BigInteger.h.
BigInteger & lsst::sphgeom::BigInteger::add | ( | BigInteger const & | b | ) |
add
adds b to this integer.
Definition at line 163 of file BigInteger.cc.
|
inline |
getCapacity
returns the number of digits in the underlying digit array.
Definition at line 81 of file BigInteger.h.
|
inline |
getDigits
returns the underlying digit array.
Definition at line 84 of file BigInteger.h.
|
inline |
getSign
returns -1, 0 or 1 if this integer is negative, zero or positive.
Definition at line 74 of file BigInteger.h.
|
inline |
getSize
returns the number of digits in the value of this integer.
Definition at line 77 of file BigInteger.h.
BigInteger & lsst::sphgeom::BigInteger::multiply | ( | BigInteger const & | b | ) |
multiply
multiplies this integer by b.
Definition at line 256 of file BigInteger.cc.
BigInteger & lsst::sphgeom::BigInteger::multiplyPow2 | ( | unsigned | n | ) |
multiplyPow2
multiplies this integer by 2ⁿ.
Definition at line 221 of file BigInteger.cc.
|
inline |
negate
multiplies this integer by -1.
Definition at line 109 of file BigInteger.h.
|
inline |
Definition at line 62 of file BigInteger.h.
|
inline |
setTo
sets this integer to the given signed 64 bit integer value.
Definition at line 90 of file BigInteger.h.
|
inline |
setTo
sets this integer to the given unsigned 64 bit integer value.
Definition at line 100 of file BigInteger.h.
|
inline |
setToZero
sets this integer to zero.
Definition at line 87 of file BigInteger.h.
BigInteger & lsst::sphgeom::BigInteger::subtract | ( | BigInteger const & | b | ) |
subtract
subtracts b from this integer.
Definition at line 208 of file BigInteger.cc.