Mutable
A arbitrary-precision big integer, with a fixed set of mutable limbs.
Fields of this type
Fields
- limbs:[]Limb
- Raw digits.
- len:usize
- positive:bool
Functions in this namespace
Functions
- toInt
- Convert `self` to `Int`.
- toFloat
- Convert `self` to `Float`.
- eqlZero
- Returns true if `a == 0`.
- toManaged
- Asserts that the allocator owns the limbs memory.
- init
- `value` is a primitive integer type.
- copy
- Copies the value of a Const to an existing Mutable so that they both have the same value.
- swap
- Efficiently swap an Mutable with another.
- clone
- Clones an Mutable and returns a new Mutable with the same value.
- abs
- Modify to become the absolute value
- set
- Sets the Mutable to value.
- setString
- Set self from the string representation `value`.
- setTwosCompIntLimit
- Set self to either bound of a 2s-complement integer.
- setFloat
- Sets the Mutable to a float value rounded according to `round`.
- addScalar
- r = a + scalar
- add
- r = a + b
- addWrap
- r = a + b with 2s-complement wrapping semantics.
- addSat
- r = a + b with 2s-complement saturating semantics.
- sub
- r = a - b
- subWrap
- r = a - b with 2s-complement wrapping semantics.
- subSat
- r = a - b with 2s-complement saturating semantics.
- mul
- rma = a * b
- mulNoAlias
- rma = a * b
- mulWrap
- rma = a * b with 2s-complement wrapping semantics.
- mulWrapNoAlias
- rma = a * b with 2s-complement wrapping semantics.
- bitReverse
- r = @bitReverse(a) with 2s-complement semantics.
- byteSwap
- r = @byteSwap(a) with 2s-complement semantics.
- popCount
- r = @popCount(a) with 2s-complement semantics.
- sqrNoAlias
- rma = a * a
- divFloor
- q = a / b (rem r)
- divTrunc
- q = a / b (rem r)
- shiftLeft
- r = a << shift, in other words, r = a * 2^shift
- shiftLeftSat
- r = a <<| shift with 2s-complement saturating semantics.
- shiftRight
- r = a >> shift
- bitNotWrap
- r = ~a under 2s complement wrapping semantics.
- bitOr
- r = a | b under 2s complement semantics.
- bitAnd
- r = a & b under 2s complement semantics.
- bitXor
- r = a ^ b under 2s complement semantics.
- gcd
- rma may alias x or y.
- pow
- q = a ^ b
- sqrt
- r = ⌊√a⌋
- gcdNoAlias
- rma may not alias x or y.
- truncate
- Truncate an integer to a number of bits, following 2s-complement semantics.
- saturate
- Saturate an integer to a number of bits, following 2s-complement semantics.
- readTwosComplement
- Read the value of `x` from `buffer`.
- readPackedTwosComplement
- Read the value of `x` from a packed memory `buffer`.
- normalize
- Normalize a possible sequence of leading zeros.
Error sets in this namespace