Polly 19.0.0git
Macros | Functions | Variables
imath/gmp_compat.c File Reference
#include "gmp_compat.h"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define CHECK(res)   assert(((res) == MP_OK) && "expected MP_OK")
 
#define HOST_ENDIAN   (*(signed char *)&endian_test)
 

Functions

void GMPQAPI() clear (mp_rat x)
 
int GMPQAPI() cmp (mp_rat op1, mp_rat op2)
 
void GMPQAPI() init (mp_rat x)
 
void GMPQAPI() mul (mp_rat product, mp_rat multiplier, mp_rat multiplicand)
 
void GMPQAPI() set (mp_rat rop, mp_rat op)
 
void GMPZAPI() abs (mp_int rop, mp_int op)
 
void GMPZAPI() add (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() clear (mp_int x)
 
int GMPZAPI() cmp_si (mp_int op1, long op2)
 
int GMPZAPI() cmpabs (mp_int op1, mp_int op2)
 
int GMPZAPI() cmp (mp_int op1, mp_int op2)
 
void GMPZAPI() init (mp_int x)
 
void GMPZAPI() mul (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() neg (mp_int rop, mp_int op)
 
void GMPZAPI() set_si (mp_int rop, long op)
 
void GMPZAPI() set (mp_int rop, mp_int op)
 
void GMPZAPI() sub (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() swap (mp_int rop1, mp_int rop2)
 
int GMPQAPI() sgn (mp_rat op)
 
int GMPZAPI() sgn (mp_int op)
 
void GMPQAPI() set_ui (mp_rat rop, unsigned long op1, unsigned long op2)
 
void GMPZAPI() set_ui (mp_int rop, unsigned long op)
 
mp_int GMPQAPI() denref (mp_rat op)
 
mp_int GMPQAPI() numref (mp_rat op)
 
void GMPQAPI() canonicalize (mp_rat op)
 
void GMPZAPI() addmul (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() divexact (mp_int q, mp_int n, mp_int d)
 
int GMPZAPI() divisible_p (mp_int n, mp_int d)
 
void GMPZAPI() submul (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() add_ui (mp_int rop, mp_int op1, unsigned long op2)
 
void GMPZAPI() divexact_ui (mp_int q, mp_int n, unsigned long d)
 
void GMPZAPI() mul_ui (mp_int rop, mp_int op1, unsigned long op2)
 
void GMPZAPI() pow_ui (mp_int rop, mp_int base, unsigned long exp)
 
void GMPZAPI() sub_ui (mp_int rop, mp_int op1, unsigned long op2)
 
void GMPZAPI() gcd (mp_int rop, mp_int op1, mp_int op2)
 
char *GMPZAPI() get_str (char *str, int radix, mp_int op)
 
char *GMPQAPI() get_str (char *str, int radix, mp_rat op)
 
int GMPZAPI() set_str (mp_int rop, char *str, int base)
 
int GMPQAPI() set_str (mp_rat rop, char *s, int base)
 
static unsigned long get_long_bits (mp_int op)
 
unsigned long GMPZAPI() get_ui (mp_int op)
 
long GMPZAPI() get_si (mp_int op)
 
void GMPZAPI() lcm (mp_int rop, mp_int op1, mp_int op2)
 
void GMPZAPI() mul_2exp (mp_int rop, mp_int op1, unsigned long op2)
 
void GMPZAPI() cdiv_q (mp_int q, mp_int n, mp_int d)
 
void GMPZAPI() fdiv_q (mp_int q, mp_int n, mp_int d)
 
void GMPZAPI() fdiv_r (mp_int r, mp_int n, mp_int d)
 
void GMPZAPI() tdiv_q (mp_int q, mp_int n, mp_int d)
 
unsigned long GMPZAPI() fdiv_q_ui (mp_int q, mp_int n, unsigned long d)
 
void *GMPZAPI() export (void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int op)
 
void GMPZAPI() import (mp_int rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op)
 
size_t GMPZAPI() sizeinbase (mp_int op, int base)
 

Variables

static const uint16_t endian_test = 0x1FF
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   res)    assert(((res) == MP_OK) && "expected MP_OK")

Definition at line 43 of file imath/gmp_compat.c.

◆ HOST_ENDIAN

#define HOST_ENDIAN   (*(signed char *)&endian_test)

Definition at line 50 of file imath/gmp_compat.c.

Function Documentation

◆ abs()

void GMPZAPI() abs ( mp_int  rop,
mp_int  op 
)

Definition at line 75 of file imath/gmp_compat.c.

References CHECK, mp_int_abs, and op.

Referenced by error_string(), isl_sioimath_lcm(), main(), parse_int_values(), and parse_rat_values().

◆ add()

void GMPZAPI() add ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

Definition at line 78 of file imath/gmp_compat.c.

References CHECK, and mp_int_add.

Referenced by collect_validity(), FN(), isl_schedule_band_replace_ast_build_option(), LIST(), and MULTI().

◆ add_ui()

void GMPZAPI() add_ui ( mp_int  rop,
mp_int  op1,
unsigned long  op2 
)

Definition at line 207 of file imath/gmp_compat.c.

References CHECK, mp_int_add, mp_int_clear, and mp_int_init_uvalue.

◆ addmul()

void GMPZAPI() addmul ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

Definition at line 154 of file imath/gmp_compat.c.

References CHECK, mp_int_add, mp_int_clear, mp_int_init, and mp_int_mul.

◆ canonicalize()

void GMPQAPI() canonicalize ( mp_rat  op)

Definition at line 146 of file imath/gmp_compat.c.

References CHECK, mp_rat_reduce, and op.

◆ cdiv_q()

void GMPZAPI() cdiv_q ( mp_int  q,
mp_int  n,
mp_int  d 
)

◆ clear() [1/2]

void GMPZAPI() clear ( mp_int  x)

Definition at line 83 of file imath/gmp_compat.c.

References mp_int_clear.

◆ clear() [2/2]

void GMPQAPI() clear ( mp_rat  x)

Definition at line 58 of file imath/gmp_compat.c.

References mp_rat_clear.

◆ cmp() [1/2]

int GMPZAPI() cmp ( mp_int  op1,
mp_int  op2 
)

Definition at line 96 of file imath/gmp_compat.c.

References mp_int_compare.

◆ cmp() [2/2]

int GMPQAPI() cmp ( mp_rat  op1,
mp_rat  op2 
)

◆ cmp_si()

int GMPZAPI() cmp_si ( mp_int  op1,
long  op2 
)

Definition at line 86 of file imath/gmp_compat.c.

References mp_int_compare_value.

◆ cmpabs()

int GMPZAPI() cmpabs ( mp_int  op1,
mp_int  op2 
)

Definition at line 91 of file imath/gmp_compat.c.

References mp_int_compare_unsigned.

◆ denref()

mp_int GMPQAPI() denref ( mp_rat  op)

Definition at line 140 of file imath/gmp_compat.c.

References mp_rat_denom_ref, and op.

◆ divexact()

void GMPZAPI() divexact ( mp_int  q,
mp_int  n,
mp_int  d 
)

Definition at line 166 of file imath/gmp_compat.c.

References CHECK, mp_int_div, and n.

◆ divexact_ui()

void GMPZAPI() divexact_ui ( mp_int  q,
mp_int  n,
unsigned long  d 
)

Definition at line 219 of file imath/gmp_compat.c.

References CHECK, mp_int_clear, mp_int_div, mp_int_init_uvalue, and n.

◆ divisible_p()

int GMPZAPI() divisible_p ( mp_int  n,
mp_int  d 
)

Definition at line 173 of file imath/gmp_compat.c.

References CHECK, mp_int_clear, mp_int_compare_zero, mp_int_div, mp_int_init, and n.

◆ export()

void *GMPZAPI() export ( void *  rop,
size_t *  countp,
int  order,
size_t  size,
int  endian,
size_t  nails,
mp_int  op 
)

◆ fdiv_q()

void GMPZAPI() fdiv_q ( mp_int  q,
mp_int  n,
mp_int  d 
)

◆ fdiv_q_ui()

unsigned long GMPZAPI() fdiv_q_ui ( mp_int  q,
mp_int  n,
unsigned long  d 
)

◆ fdiv_r()

void GMPZAPI() fdiv_r ( mp_int  r,
mp_int  n,
mp_int  d 
)

Definition at line 593 of file imath/gmp_compat.c.

References CHECK, fdiv_q(), GMPZAPI, mp_int_clear, mp_int_init, mp_int_init_copy, mp_int_mul, mp_int_sub, and n.

Referenced by fdiv_q_ui().

◆ gcd()

void GMPZAPI() gcd ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

◆ get_long_bits()

static unsigned long get_long_bits ( mp_int  op)
static

Definition at line 390 of file imath/gmp_compat.c.

References MP_DIGIT_BIT, MP_DIGITS(), MP_USED(), and op.

Referenced by get_si(), and get_ui().

◆ get_si()

long GMPZAPI() get_si ( mp_int  op)

Definition at line 435 of file imath/gmp_compat.c.

References CHECK, get_long_bits(), mp_int_to_int, MP_NEG, MP_OK, MP_RANGE, MP_SIGN(), op, and res.

◆ get_str() [1/2]

char *GMPZAPI() get_str ( char *  str,
int  radix,
mp_int  op 
)

Definition at line 289 of file imath/gmp_compat.c.

References CHECK, mp_int_string_len, mp_int_to_string, op, and str.

Referenced by get_str().

◆ get_str() [2/2]

char *GMPQAPI() get_str ( char *  str,
int  radix,
mp_rat  op 
)

◆ get_ui()

unsigned long GMPZAPI() get_ui ( mp_int  op)

Definition at line 419 of file imath/gmp_compat.c.

References CHECK, get_long_bits(), mp_int_to_uint, MP_OK, MP_RANGE, op, and res.

◆ import()

void GMPZAPI() import ( mp_int  rop,
size_t  count,
int  order,
size_t  size,
int  endian,
size_t  nails,
const void *  op 
)

◆ init() [1/2]

void GMPZAPI() init ( mp_int  x)

Definition at line 99 of file imath/gmp_compat.c.

References CHECK, and mp_int_init.

◆ init() [2/2]

void GMPQAPI() init ( mp_rat  x)

◆ lcm()

void GMPZAPI() lcm ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

Definition at line 466 of file imath/gmp_compat.c.

References CHECK, mp_int_abs, mp_int_compare_zero, mp_int_lcm, and mp_int_zero.

Referenced by add_vertex(), isl_seq_lcm(), and isl_vec_lcm().

◆ mul() [1/2]

void GMPZAPI() mul ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

Definition at line 102 of file imath/gmp_compat.c.

References CHECK, and mp_int_mul.

◆ mul() [2/2]

void GMPQAPI() mul ( mp_rat  product,
mp_rat  multiplier,
mp_rat  multiplicand 
)

Definition at line 67 of file imath/gmp_compat.c.

References CHECK, and mp_rat_mul.

Referenced by arctan().

◆ mul_2exp()

void GMPZAPI() mul_2exp ( mp_int  rop,
mp_int  op1,
unsigned long  op2 
)

Definition at line 481 of file imath/gmp_compat.c.

References CHECK, mp_int_compare_zero, mp_int_mul_pow2, and mp_int_zero.

◆ mul_ui()

void GMPZAPI() mul_ui ( mp_int  rop,
mp_int  op1,
unsigned long  op2 
)

Definition at line 230 of file imath/gmp_compat.c.

References CHECK, mp_int_clear, mp_int_init_uvalue, and mp_int_mul.

◆ neg()

void GMPZAPI() neg ( mp_int  rop,
mp_int  op 
)

◆ numref()

mp_int GMPQAPI() numref ( mp_rat  op)

Definition at line 143 of file imath/gmp_compat.c.

References mp_rat_numer_ref, and op.

◆ pow_ui()

void GMPZAPI() pow_ui ( mp_int  rop,
mp_int  base,
unsigned long  exp 
)

◆ set() [1/2]

void GMPZAPI() set ( mp_int  rop,
mp_int  op 
)

Definition at line 113 of file imath/gmp_compat.c.

References CHECK, mp_int_copy, and op.

◆ set() [2/2]

void GMPQAPI() set ( mp_rat  rop,
mp_rat  op 
)

Definition at line 72 of file imath/gmp_compat.c.

References CHECK, mp_rat_copy, and op.

◆ set_si()

void GMPZAPI() set_si ( mp_int  rop,
long  op 
)

Definition at line 110 of file imath/gmp_compat.c.

References CHECK, mp_int_set_value, and op.

◆ set_str() [1/2]

int GMPZAPI() set_str ( mp_int  rop,
char *  str,
int  base 
)

Definition at line 350 of file imath/gmp_compat.c.

References mp_int_read_string, MP_OK, res, and str.

◆ set_str() [2/2]

int GMPQAPI() set_str ( mp_rat  rop,
char *  s,
int  base 
)

◆ set_ui() [1/2]

void GMPZAPI() set_ui ( mp_int  rop,
unsigned long  op 
)

Definition at line 135 of file imath/gmp_compat.c.

References CHECK, mp_int_set_uvalue, and op.

◆ set_ui() [2/2]

void GMPQAPI() set_ui ( mp_rat  rop,
unsigned long  op1,
unsigned long  op2 
)

Definition at line 130 of file imath/gmp_compat.c.

References CHECK, and mp_rat_set_uvalue.

◆ sgn() [1/2]

int GMPZAPI() sgn ( mp_int  op)

Definition at line 127 of file imath/gmp_compat.c.

References mp_int_compare_zero, and op.

◆ sgn() [2/2]

int GMPQAPI() sgn ( mp_rat  op)

◆ sizeinbase()

size_t GMPZAPI() sizeinbase ( mp_int  op,
int  base 
)

Definition at line 802 of file imath/gmp_compat.c.

References CHECK, mp_int_compare_zero, mp_int_string_len, MP_OK, op, res, and size.

◆ sub()

void GMPZAPI() sub ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

◆ sub_ui()

void GMPZAPI() sub_ui ( mp_int  rop,
mp_int  op1,
unsigned long  op2 
)

Definition at line 259 of file imath/gmp_compat.c.

References CHECK, mp_int_clear, mp_int_init_uvalue, and mp_int_sub.

◆ submul()

void GMPZAPI() submul ( mp_int  rop,
mp_int  op1,
mp_int  op2 
)

Definition at line 195 of file imath/gmp_compat.c.

References CHECK, mp_int_clear, mp_int_init, mp_int_mul, and mp_int_sub.

◆ swap()

void GMPZAPI() swap ( mp_int  rop1,
mp_int  rop2 
)

Definition at line 121 of file imath/gmp_compat.c.

References mp_int_swap.

Referenced by isl_basic_map_gauss5().

◆ tdiv_q()

void GMPZAPI() tdiv_q ( mp_int  q,
mp_int  n,
mp_int  d 
)

Definition at line 623 of file imath/gmp_compat.c.

References CHECK, mp_int_div, and n.

Variable Documentation

◆ endian_test

const uint16_t endian_test = 0x1FF
static

Definition at line 49 of file imath/gmp_compat.c.