TaPAS  0.2
genepi-util-inline.h
Go to the documentation of this file.
1 /*
2  * genepi-util-inline.h -- Generic functions implemented with GENEPI routines
3  *
4  * This file is a part of the GENEric Presburger programming Interface.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Université Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
29 #ifndef __GENEPI_UTIL_INLINE_H__
30 # define __GENEPI_UTIL_INLINE_H__
31 
32 BEGIN_C_DECLS
33 
34  /* --------------- */
35 
36 static inline genepi_set *
37 genepi_set_aX_plus_bY (genepi_solver *solver, int a, genepi_set *X, int b,
38  genepi_set *Y)
39 {
40  int coeff[2];
41  genepi_set *args[2];
42  coeff[0] = a;
43  coeff[1] = b;
44  args[0] = X;
45  args[1] = Y;
46 
47  return genepi_set_linear_transform (solver, 2, coeff, 0, args);
48 }
49 
50  /* --------------- */
51 
52 static inline genepi_set *
54 {
55  return genepi_set_aX_plus_bY (solver, 1, X, 1, Y);
56 }
57 
58  /* --------------- */
59 
60 static inline genepi_set *
62 {
63  return genepi_set_aX_plus_bY (solver, 1, X, -1, Y);
64 }
65 
66  /* --------------- */
67 
68 static inline genepi_set *
69 genepi_set_scale (genepi_solver *solver, int s, genepi_set *X)
70 {
71  return genepi_set_linear_transform (solver, 1, &s, 0, &X);
72 }
73 
74  /* --------------- */
75 
76 static inline genepi_set *
78 {
79  return genepi_set_scale (solver, -1, X);
80 }
81 
82 END_C_DECLS
83 
84 #endif /* ! __GENEPI_UTIL_INLINE_H__ */
static genepi_set * genepi_set_sub(genepi_solver *solver, genepi_set *X, genepi_set *Y)
Computes .
static genepi_set * genepi_set_scale(genepi_solver *solver, int s, genepi_set *X)
Computes .
struct genepi_set_st genepi_set
Abstraction of Presburger definable set.
Definition: genepi.h:190
static genepi_set * genepi_set_aX_plus_bY(genepi_solver *solver, int a, genepi_set *X, int b, genepi_set *Y)
Computes .
static genepi_set * genepi_set_neg(genepi_solver *solver, genepi_set *X)
Computes .
static genepi_set * genepi_set_add(genepi_solver *solver, genepi_set *X, genepi_set *Y)
Computes .
struct genepi_solver_st genepi_solver
Type of GENEPI solver.
Definition: genepi.h:180
genepi_set * genepi_set_linear_transform(genepi_solver *solver, int n, int *alpha, int c, genepi_set **X)
Computes .