Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros
cmp.h File Reference

Macro definitions for MIN, MAX, and CLAMP. More...

Go to the source code of this file.

Macros

#define MAX(a, b)   ( ((a)<(b)) ? (b) : (a) )
 
#define MIN(a, b)   ( ((a)>(b)) ? (b) : (a) )
 
#define CLAMP(min, v, max)
 
#define ABS(x)   ( ((x)<0) ? -(x) : (x) )
 

Detailed Description

Macro definitions for MIN, MAX, and CLAMP.

Definition in file cmp.h.

Macro Definition Documentation

◆ ABS

#define ABS (   x)    ( ((x)<0) ? -(x) : (x) )

Give the absolute value of x, independent of its type.

Definition at line 40 of file cmp.h.

◆ CLAMP

#define CLAMP (   min,
  v,
  max 
)
Value:
( ((v) < (min)) ? (min) : \
((v) > (max)) ? (max) : \
(v) )

Definition at line 34 of file cmp.h.

◆ MAX

#define MAX (   a,
 
)    ( ((a)<(b)) ? (b) : (a) )

Macros for MIN/MAX. Never use these when the arguments could have side-effects. {With GCC extensions we could probably define a safer MIN/MAX. But depending on that safety would be dangerous, since not every platform has it.}

Definition at line 22 of file cmp.h.

◆ MIN

#define MIN (   a,
 
)    ( ((a)>(b)) ? (b) : (a) )

Definition at line 25 of file cmp.h.