Files | |
| file | eg_nummacros.h |
This file provide the user interface and function definitions for general number utilities. | |
Defines | |
| #define | EGabs(var) |
| a general macro to return the absolute value of the given variable | |
| #define | EGmax(a, b) |
| given two variables (of the same type, and of some predefined type) return the maximum value among the two of them. | |
| #define | EGmin(a, b) |
| given two variables (of the same type, and of some predefined type) return the minimum value among the two of them. | |
| #define | EGswap(N1, N2, Ntmp) |
| Given tree numbers N1, N2 and Ntmp, swap values of N1 and N2 using Ntmp as a temporal number. The variables should be of some primitive type of C for this macro to work. | |
Here we put some utilities common for number.
| #define EGabs | ( | var | ) |
({\
const typeof(var) __EGav = (var);\
(__EGav < 0) ? -__EGav : __EGav;})
a general macro to return the absolute value of the given variable
| var | variable whose absolute value we want to compute. |
Definition at line 75 of file eg_nummacros.h.
| #define EGmax | ( | a, | ||
| b | ||||
| ) |
({\
const typeof(a) __EGma = (a);\
const typeof(b) __EGmb = (b);\
(__EGma > __EGmb ? __EGma : __EGmb);})
given two variables (of the same type, and of some predefined type) return the maximum value among the two of them.
Definition at line 56 of file eg_nummacros.h.
| #define EGmin | ( | a, | ||
| b | ||||
| ) |
({\
const typeof(a) __EGma = (a);\
const typeof(b) __EGmb = (b);\
(__EGma < __EGmb ? __EGma : __EGmb);})
given two variables (of the same type, and of some predefined type) return the minimum value among the two of them.
Definition at line 64 of file eg_nummacros.h.
Referenced by main().
| #define EGswap | ( | N1, | ||
| N2, | ||||
| Ntmp | ||||
| ) |
do{\ Ntmp = N1;\ N1 = N2;\ N2 = Ntmp;} while(0)
Given tree numbers N1, N2 and Ntmp, swap values of N1 and N2 using Ntmp as a temporal number. The variables should be of some primitive type of C for this macro to work.
| N1 | first number. | |
| N2 | second number. | |
| Ntmp | temporal variable. |
Definition at line 48 of file eg_nummacros.h.
Referenced by EGcharPermSort().
1.7.1