add isl_multi_aff_to_polylib
[barvinok.git] / zsolve / defs.c
blobfacd83e52c13cc6a8cfd33ffad09d605ef2826b6
1 /*
2 4ti2 -- A software package for algebraic, geometric and combinatorial
3 problems on linear spaces.
5 Copyright (C) 2006 4ti2 team.
6 Main author(s): Matthias Walter.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
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.
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 02110-1301, USA.
23 #include "defs.h"
25 // //
27 int _gcd(int a, int b)
29 if (b!=0)
30 return _gcd(b, a % b);
31 else
32 return a;
35 // //
37 int gcd(int a, int b)
39 if (a<0)
40 a *= -1;
41 if (b<0)
42 b *= -1;
43 if (a>b)
44 return _gcd(a, b);
45 else
46 return _gcd(b, a);
49 // //
51 int mini(int a, int b)
53 return a<b ? a : b;
56 // //
58 int maxi(int a, int b)
60 return a>b ? a : b;
63 // //
65 double maxd(double a, double b)
67 return a>b ? a : b;