/[ascend]/trunk/base/generic/general/mathmacros.h
ViewVC logotype

Contents of /trunk/base/generic/general/mathmacros.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 124 - (show annotations) (download) (as text)
Tue Dec 20 08:32:25 2005 UTC (18 years, 5 months ago) by johnpye
File MIME type: text/x-chdr
File size: 573 byte(s)
Adding 'TEST' statement to ASCEND METHOD syntax.
Standardising messages in slv3.
Trying to debug bug #175.
1 #ifndef ASC_MATHMACROS_H
2 #define ASC_MATHMACROS_H
3
4 /* Macros for MAX, MIN and ABS... */
5 #ifdef __GNUC__
6 # define MAX(X,Y) \
7 ( { __typeof__ (X) x_ = (X); \
8 __typeof__ (Y) y_ = (Y); \
9 (x_ > y_) ? x_ : y_; \
10 } )
11 # define MIN(X,Y) \
12 ( { __typeof__ (X) x_ = (X); \
13 __typeof__ (Y) y_ = (Y); \
14 (x_ < y_) ? x_ : y_; \
15 } )
16 # define ABS(X) \
17 ( { __typeof__ (X) x_ = (X); \
18 (x_ > 0) ? x_ : -x_; \
19 } )
20 #else
21 # define MAX(a,b) ( (a) < (b) ? (b) : (a) )
22 # define MIN(a,b) ( (a) < (b) ? (a) : (b) )
23 # define ABS(x) ( ((x) > 0) ? (x) : -(x) )
24 #endif
25
26 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22