My Project
|
#include "misc/auxiliary.h"
#include "coeffs/si_gmp.h"
#include "coeffs/coeffs.h"
#include "factory/si_log2.h"
Go to the source code of this file.
Data Structures | |
struct | number |
'SR_INT' is the type of those integers small enough to fit into 29 bits. More... | |
Macros | |
#define | SR_HDL(A) ((long)(A)) |
#define | SR_INT 1L |
#define | INT_TO_SR(INT) ((number) (((long)INT << 2) + SR_INT)) |
#define | SR_TO_INT(SR) (((long)SR) >> 2) |
#define | MP_SMALL 1 |
Functions | |
number | nlGetDenom (number &n, const coeffs r) |
number | nlGetNumerator (number &n, const coeffs r) |
BOOLEAN | nlInitChar (coeffs, void *) |
static FORCE_INLINE int | nlQlogSize (number n, const coeffs r) |
only used by slimgb (tgb.cc) More... | |
static FORCE_INLINE BOOLEAN | nlIsInteger (number q, const coeffs r) |
void | nlMPZ (mpz_t m, number &n, const coeffs r) |
number | nlModP (number q, const coeffs Q, const coeffs Zp) |
void | nlNormalize (number &x, const coeffs r) |
void | nlInpGcd (number &a, number b, const coeffs r) |
void | nlDelete (number *a, const coeffs r) |
number | nlInit2 (int i, int j, const coeffs r) |
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode More... | |
number | nlInit2gmp (mpz_t i, mpz_t j, const coeffs r) |
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode More... | |
number | nlChineseRemainderSym (number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF) |
struct snumber |
'SR_INT' is the type of those integers small enough to fit into 29 bits.
Therefor the value range of this small integers is: $-2^{28}...2^{28}-1$.
Small integers are represented by an immediate integer handle, containing the value instead of pointing to it, which has the following form:
+-------+-------+-------+-------+- - - -+-------+-------+-------+ | guard | sign | bit | bit | | bit | tag | tag | | bit | bit | 27 | 26 | | 0 | 0 | 1 | +-------+-------+-------+-------+- - - -+-------+-------+-------+
Immediate integers handles carry the tag 'SR_INT', i.e. the last bit is 1. This distuingishes immediate integers from other handles which point to structures aligned on 4 byte boundaries and therefor have last bit zero. (The second bit is reserved as tag to allow extensions of this scheme.) Using immediates as pointers and dereferencing them gives address errors.
To aid overflow check the most significant two bits must always be equal, that is to say that the sign bit of immediate integers has a guard bit.
The macros 'INT_TO_SR' and 'SR_TO_INT' should be used to convert between a small integer value and its representation as immediate integer handle.
Large integers and rationals are represented by z and n where n may be undefined (if s==3) NULL represents only deleted values
Data Fields | ||
---|---|---|
int | debug | |
mpz_t | n | |
BOOLEAN | s | parameter s in number: 0 (or FALSE): not normalised rational 1 (or TRUE): normalised rational 3 : integer with n==NULL |
mpz_t | z |
#define INT_TO_SR | ( | INT | ) | ((number) (((long)INT << 2) + SR_INT)) |
number nlChineseRemainderSym | ( | number * | x, |
number * | q, | ||
int | rl, | ||
BOOLEAN | sym, | ||
CFArray & | inv_cache, | ||
const coeffs | CF | ||
) |
Definition at line 3095 of file longrat.cc.
Definition at line 2666 of file longrat.cc.
Definition at line 1640 of file longrat.cc.
Definition at line 1669 of file longrat.cc.
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
Definition at line 2544 of file longrat.cc.
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
Definition at line 2557 of file longrat.cc.
Definition at line 3475 of file longrat.cc.
Definition at line 2933 of file longrat.cc.
|
static |
Definition at line 1577 of file longrat.cc.
Definition at line 2819 of file longrat.cc.
Definition at line 1486 of file longrat.cc.