OpenScop  0.9.0
Data Structures | Typedefs | Functions
int.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  osl_int

Typedefs

typedef union osl_int osl_int_t
typedef union osl_intosl_int_p
typedef union osl_int const osl_const_int_t
typedef union osl_int *const osl_int_const_p
typedef union osl_int const * osl_const_int_p
typedef union osl_int const *const osl_const_int_const_p

Functions

int osl_int_is_precision_supported (int)
void osl_int_dump_precision (FILE *, int)
void osl_int_init (int, osl_int_const_p)
osl_int_p osl_int_malloc (int)
void osl_int_assign (int, osl_int_const_p, osl_const_int_t)
void osl_int_set_si (int, osl_int_const_p, int)
int osl_int_get_si (int, osl_const_int_t)
double osl_int_get_d (int, osl_const_int_t)
 Get a double from the osl_int_t.
void osl_int_init_set (int, osl_int_const_p, osl_const_int_t)
void osl_int_init_set_si (int, osl_int_const_p, int)
void osl_int_swap (int, osl_int_const_p, osl_int_const_p)
void osl_int_clear (int, osl_int_const_p)
void osl_int_free (int, osl_int_const_p)
void osl_int_print (FILE *, int, osl_const_int_t)
void osl_int_sprint (char *, int, osl_const_int_t)
void osl_int_sprint_txt (char *, int, osl_const_int_t)
int osl_int_sscanf (char *, int, osl_int_const_p)
void osl_int_sread (char **, int, osl_int_const_p)
void osl_int_increment (int, osl_int_const_p, osl_const_int_t)
void osl_int_decrement (int, osl_int_const_p, osl_const_int_t)
void osl_int_add (int, osl_int_const_p, osl_const_int_t, osl_const_int_t)
void osl_int_add_si (int, osl_int_const_p, osl_const_int_t, int)
void osl_int_sub (int, osl_int_const_p, osl_const_int_t, osl_const_int_t)
void osl_int_mul (int, osl_int_const_p, osl_const_int_t, osl_const_int_t)
void osl_int_mul_si (int, osl_int_const_p, osl_const_int_t, int)
void osl_int_div_exact (int const, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 q <- a / b
void osl_int_floor_div_q (int const, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 q <- floor(a / b)
void osl_int_floor_div_r (int const, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 r <- a - b * (a / b) (r <- a % b is used)
void osl_int_floor_div_q_r (int const, osl_int_const_p, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 Compute (q, r) such that a = b * q + r.
void osl_int_mod (int const, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 mod <- a % b
void osl_int_gcd (int const, osl_int_const_p, osl_const_int_t, osl_const_int_t)
 Compute the gcd (greatest common divisor) of a and b.
void osl_int_oppose (int, osl_int_const_p, osl_const_int_t)
void osl_int_abs (int, osl_int_const_p, osl_const_int_t)
size_t osl_int_size_in_base_2 (int const, osl_const_int_t)
size_t osl_int_size_in_base_10 (int const, osl_const_int_t)
int osl_int_eq (int, osl_const_int_t, osl_const_int_t)
int osl_int_ne (int, osl_const_int_t, osl_const_int_t)
int osl_int_pos (int, osl_const_int_t)
int osl_int_neg (int, osl_const_int_t)
int osl_int_zero (int, osl_const_int_t)
int osl_int_one (int, osl_const_int_t)
int osl_int_mone (int, osl_const_int_t)
int osl_int_divisible (int, osl_const_int_t, osl_const_int_t)

Typedef Documentation

typedef union osl_int const* const osl_const_int_const_p

Definition at line 93 of file int.h.

typedef union osl_int const* osl_const_int_p

Definition at line 92 of file int.h.

typedef union osl_int const osl_const_int_t

Definition at line 90 of file int.h.

typedef union osl_int* const osl_int_const_p

Definition at line 91 of file int.h.

typedef union osl_int* osl_int_p

Definition at line 89 of file int.h.

typedef union osl_int osl_int_t

Definition at line 88 of file int.h.


Function Documentation

void osl_int_abs ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value 
)

variable <- | value |;

Definition at line 914 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

void osl_int_add ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

variable <- val1 + val2;

Definition at line 524 of file int.c.

References OSL_error, osl_int_neg(), osl_int_pos(), OSL_overflow, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_sub(), osl_relation_add_vector(), and osl_vector_add().

void osl_int_add_si ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value,
int  i 
)
void osl_int_assign ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value 
)
void osl_int_clear ( int  precision,
osl_int_const_p  variable 
)

variable = 0; // Including cleaning for GMP

Definition at line 353 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_free(), osl_relation_free_inside(), and osl_vector_free().

void osl_int_decrement ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value 
)

variable <- value - 1;

Definition at line 515 of file int.c.

References osl_int_add_si().

void osl_int_div_exact ( int const  precision,
osl_int_const_p  q,
osl_const_int_t  a,
osl_const_int_t  b 
)

q <- a / b

Precondition:
b divides a (without remainder)

Definition at line 720 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

int osl_int_divisible ( int  precision,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

((val1 % val2) == 0)

Definition at line 1147 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_relation_get_array_id().

void osl_int_dump_precision ( FILE *  file,
int  precision 
)

osl_int_dump_precision function: this function prints in a human readable fashion the precision corresponding to the "precision" parameter.

Parameters:
[in]fileThe file where to print the precision.
[in]precisionThe precision to print.

Definition at line 113 of file int.c.

References OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_relation_idump(), and osl_vector_idump().

int osl_int_eq ( int  precision,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

(val1 == val2)

Definition at line 1007 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_ne().

void osl_int_floor_div_q ( int const  precision,
osl_int_const_p  q,
osl_const_int_t  a,
osl_const_int_t  b 
)

q <- floor(a / b)

q is the quotient

Definition at line 742 of file int.c.

References OSL_error, osl_int_neg(), osl_int_pos(), OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_floor_div_q_r(), and osl_int_floor_div_r().

void osl_int_floor_div_q_r ( int const  precision,
osl_int_const_p  q,
osl_int_const_p  r,
osl_const_int_t  a,
osl_const_int_t  b 
)

Compute (q, r) such that a = b * q + r.

q is the quotient
r is the remainder

Definition at line 811 of file int.c.

References OSL_error, osl_int_floor_div_q(), OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

void osl_int_floor_div_r ( int const  precision,
osl_int_const_p  r,
osl_const_int_t  a,
osl_const_int_t  b 
)

r <- a - b * (a / b) (r <- a % b is used)

r is the remainder

Definition at line 782 of file int.c.

References OSL_error, osl_int_floor_div_q(), OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

void osl_int_free ( int  ,
osl_int_const_p   
)

Definition at line 376 of file int.c.

References osl_int_clear().

void osl_int_gcd ( int  const,
osl_int_const_p  ,
osl_const_int_t  ,
osl_const_int_t   
)

Compute the gcd (greatest common divisor) of a and b.

Definition at line 869 of file int.c.

References llgcd(), OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

double osl_int_get_d ( int  precision,
osl_const_int_t  i 
)

Get a double from the osl_int_t.

Parameters:
[in]precisionPrecision used.
[in]iA osl_int_t
Returns:
a double from the value.

Definition at line 259 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

int osl_int_get_si ( int  precision,
osl_const_int_t  value 
)
void osl_int_increment ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value 
)

variable <- value + 1;

Definition at line 506 of file int.c.

References osl_int_add_si().

void osl_int_init ( int  ,
osl_int_const_p   
)
void osl_int_init_set ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  i 
)

variable = i; // including initialization for GMP

Definition at line 281 of file int.c.

References osl_int_assign(), and osl_int_init().

void osl_int_init_set_si ( int  precision,
osl_int_const_p  variable,
int  i 
)

variable = i; // including initialization for GMP

Definition at line 290 of file int.c.

References OSL_error, OSL_malloc, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_relation_pmalloc(), and osl_vector_pmalloc().

int osl_int_is_precision_supported ( int  precision)

osl_int_is_precision_supported function: this function returns 1 if the precision provided as parameter is supported by the library and 0 otherwise. Possible values for the precision parameter are OSL_PRECISION_SP for 32 bits (single) precision, OSL_PRECISION_DP for 64 bits (double) precision and OSL_PRECISION_MP for multiple precision.

Parameters:
[in]precisionThe precision to check for.
Returns:
1 if the precision is supported, 0 otherwise.

Definition at line 90 of file int.c.

References OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Definition at line 155 of file int.c.

References osl_int_init(), and OSL_malloc.

void osl_int_mod ( int const  precision,
osl_int_const_p  mod,
osl_const_int_t  a,
osl_const_int_t  b 
)

mod <- a % b

Precondition:
mod is always positive

Definition at line 839 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

int osl_int_mone ( int  precision,
osl_const_int_t  value 
)
void osl_int_mul ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

variable <- val1 * val2;

Definition at line 639 of file int.c.

References OSL_error, osl_int_zero(), OSL_overflow, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

void osl_int_mul_si ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value,
int  i 
)

variable <- value * i;

Definition at line 679 of file int.c.

References OSL_error, osl_int_zero(), OSL_overflow, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_vector_mul_scalar().

int osl_int_ne ( int  precision,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

(val1 != val2)

Definition at line 1029 of file int.c.

References osl_int_eq().

Referenced by osl_relation_part_equal(), and osl_vector_equal().

int osl_int_neg ( int  precision,
osl_const_int_t  value 
)
int osl_int_one ( int  precision,
osl_const_int_t  value 
)
void osl_int_oppose ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  value 
)

variable <- -value;

Definition at line 888 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_sub(), and osl_relation_subexpression().

int osl_int_pos ( int  precision,
osl_const_int_t  value 
)
void osl_int_print ( FILE *  file,
int  precision,
osl_const_int_t  value 
)

osl_int_print function: this function displays an integer value into a file (file, possibly stdout).

Parameters:
fileThe file where the integer has to be printed.
precisionThe precision of the integer.
valueThe integer element to print.

Definition at line 389 of file int.c.

References osl_int_sprint(), and OSL_MAX_STRING.

Referenced by osl_relation_idump(), and osl_vector_idump().

void osl_int_set_si ( int  precision,
osl_int_const_p  variable,
int  i 
)
size_t osl_int_size_in_base_10 ( int const  precision,
osl_const_int_t const  value 
)
Returns:
size in base 10
Warning:
mpz_sizeinbase may not return the same result with same integer in different precisions

Definition at line 983 of file int.c.

References lllog10(), OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

size_t osl_int_size_in_base_2 ( int const  precision,
osl_const_int_t const  value 
)
Returns:
size in base 2

Definition at line 951 of file int.c.

References lllog2(), OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

void osl_int_sprint ( char *  string,
int  precision,
osl_const_int_t  value 
)

osl_int_sprint function: this function prints an integer value into a string, it uses the OpenScop Library formats OSL_FMT_* to format the printing.

Parameters:
stringThe string where the integer has to be printed.
precisionThe precision of the integer.
valueThe integer element to print.

Definition at line 405 of file int.c.

References OSL_error, OSL_FMT_DP, OSL_FMT_MP, OSL_FMT_SP, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_print(), osl_relation_spprint_polylib(), and osl_relation_spprint_polylib_scoplib().

void osl_int_sprint_txt ( char *  string,
int  precision,
osl_const_int_t  value 
)

osl_int_sprint_txt function: this function is similar to osl_int_sprintf but it prints the value using OSL_TMT_TXT_* formats.

See also:
osl_int_sprintf

Definition at line 437 of file int.c.

References OSL_error, OSL_FMT_TXT_DP, OSL_FMT_TXT_MP, OSL_FMT_TXT_SP, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_relation_expression_element().

void osl_int_sread ( char **  ,
int  ,
osl_int_const_p   
)

Definition at line 492 of file int.c.

References osl_int_sscanf().

Referenced by osl_relation_pread(), and osl_relation_psread().

int osl_int_sscanf ( char *  ,
int  ,
osl_int_const_p   
)

Definition at line 463 of file int.c.

References OSL_error, OSL_FMT_TXT_DP, OSL_FMT_TXT_SP, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_int_sread().

void osl_int_sub ( int  precision,
osl_int_const_p  variable,
osl_const_int_t  val1,
osl_const_int_t  val2 
)

variable <- val1 - val2;

Definition at line 620 of file int.c.

References osl_int_add(), osl_int_init(), osl_int_oppose(), and OSL_PRECISION_MP.

Referenced by osl_relation_sub_vector(), and osl_vector_sub().

void osl_int_swap ( int  precision,
osl_int_const_p  var1,
osl_int_const_p  var2 
)

var1 <=> var2;

Definition at line 316 of file int.c.

References OSL_error, OSL_PRECISION_DP, OSL_PRECISION_MP, and OSL_PRECISION_SP.

Referenced by osl_relation_swap_constraints().

int osl_int_zero ( int  precision,
osl_const_int_t  value 
)