1 | /*************************************************************************** |
2 | kimecommon.h - description |
3 | ------------------- |
4 | begin : Thu Apr 23 2002 |
5 | copyright : (C) 2002 by Jan Schäfer |
6 | email : janschaefer@users.sourceforge.net |
7 | ***************************************************************************/ |
8 | |
9 | /*************************************************************************** |
10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * |
15 | * * |
16 | ***************************************************************************/ |
17 | |
18 | |
19 | #ifndef __KIMECOMMON_H__ |
20 | #define __KIMECOMMON_H__ |
21 | |
22 | inline int myabs(int i) { |
23 | if (i < 0) |
24 | return -i; |
25 | else |
26 | return i; |
27 | } |
28 | |
29 | inline double myabs(double i) { |
30 | if (i < 0) |
31 | return -i; |
32 | else |
33 | return i; |
34 | } |
35 | |
36 | inline int myround(double d) { |
37 | if ( (d-((int) d)) < 0.5 ) |
38 | return (int) d; |
39 | else |
40 | return ((int) d)+1; |
41 | } |
42 | |
43 | inline int roundUp(double d) |
44 | { |
45 | if ( (d-((int) d)) == 0) |
46 | return (int) d; |
47 | else |
48 | return ((int) d)+1; |
49 | } |
50 | |
51 | |
52 | #endif |
53 | |