General Number Utilities


Detailed Description

Here we put some utilities common for number.

History:
Revision 0.0.2


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.


Define Documentation

#define EGabs var   ) 
 

Value:

({\
    const typeof(var) __EGav = (var);\
    (__EGav < 0) ? -__EGav : __EGav;})
a general macro to return the absolute value of the given variable

Parameters:
var variable whose absolute value we want to compute.
Returns:
value of the absolute value of the given variable, note that this macro will only work in built-in types, and will use the default comparison for those internal types.

Definition at line 80 of file eg_nummacros.h.

#define EGmax a,
 ) 
 

Value:

({\
  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 61 of file eg_nummacros.h.

#define EGmin a,
 ) 
 

Value:

({\
  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 69 of file eg_nummacros.h.

#define EGswap N1,
N2,
Ntmp   ) 
 

Value:

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.

Parameters:
N1 first number.
N2 second number.
Ntmp temporal variable.

Definition at line 53 of file eg_nummacros.h.


Generated on Wed Nov 21 09:38:35 2007 for MTgomory by  doxygen 1.4.6