GCGlib  0.04.228
GCG Graphics Engine
General macros and inline functions

Macros

#define MIN(a, b)   ((a > b) ? (b) : (a))
 A macro that returns the minimum of a and b. More...
 
#define MAX(a, b)   ((a < b) ? (b) : (a))
 A macro that returns the maximum of a and b. More...
 
#define ABS(a)   (((a) < 0) ? -(a) : (a))
 A macro that returns the absolute value of a. More...
 
#define SWAP(a, b)   {(a) ^= (b); (b) ^= (a); (a) ^= (b);}
 A macro that swaps the values of a and b variables. More...
 
#define DEG2RAD(a)   (((a) * M_PI) / 180.0)
 A macro that converts a degrees in radians. More...
 
#define RAD2DEG(a)   (((a) * 180) / M_PI)
 A macro that converts a radians in degrees. More...
 
#define TRUE   1
 Defines the boolean value for true. More...
 
#define FALSE   0
 Defines the boolean value for false. More...
 
#define EPSILON   0.0000077
 Defines the minimum accepted value for single precision real numbers. More...
 
#define INF   1.0e+16
 Defines the biggest value for real numbers. More...
 
#define FEQUAL(a, b)   (fabs((a)-(b)) < EPSILON)
 A macro for real numbers equality comparisons. More...
 
#define M_PI   3.14159265358979323846
 A macro that defines the number PI with 20 decimals. More...
 
#define NULL   0
 Defines the null pointer. More...
 
#define ISPOWEROF2(n)   (!(n & (n-1)))
 A macro for checking if the integer number n is a power of 2. More...
 

Functions

static int SQR (int x)
 Inline function for squaring integers. More...
 
static short SQR (short x)
 Inline function for squaring shorts. More...
 
static long SQR (long x)
 Inline function for squaring longs. More...
 
static float SQR (float x)
 Inline function for squaring floats. More...
 
static double SQR (double x)
 Inline function for squaring doubles. More...
 

Detailed Description

General GCGlib macros.

Macro Definition Documentation

◆ ABS

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

A macro that returns the absolute value of a.

Since
0.01.0

◆ DEG2RAD

#define DEG2RAD (   a)    (((a) * M_PI) / 180.0)

A macro that converts a degrees in radians.

Since
0.01.0

◆ EPSILON

#define EPSILON   0.0000077

Defines the minimum accepted value for single precision real numbers.

Since
0.01.0

◆ FALSE

#define FALSE   0

Defines the boolean value for false.

Since
0.01.0

◆ FEQUAL

#define FEQUAL (   a,
 
)    (fabs((a)-(b)) < EPSILON)

A macro for real numbers equality comparisons.

Since
0.01.0

◆ INF

#define INF   1.0e+16

Defines the biggest value for real numbers.

Since
0.01.0

◆ ISPOWEROF2

#define ISPOWEROF2 (   n)    (!(n & (n-1)))

A macro for checking if the integer number n is a power of 2.

Since
0.01.0

◆ M_PI

#define M_PI   3.14159265358979323846

A macro that defines the number PI with 20 decimals.

Since
0.01.0

◆ MAX

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

A macro that returns the maximum of a and b.

Since
0.01.0

◆ MIN

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

A macro that returns the minimum of a and b.

Since
0.01.0

◆ NULL

#define NULL   0

Defines the null pointer.

Since
0.01.0

◆ RAD2DEG

#define RAD2DEG (   a)    (((a) * 180) / M_PI)

A macro that converts a radians in degrees.

Since
0.01.0

◆ SWAP

#define SWAP (   a,
 
)    {(a) ^= (b); (b) ^= (a); (a) ^= (b);}

A macro that swaps the values of a and b variables.

Since
0.01.0

◆ TRUE

#define TRUE   1

Defines the boolean value for true.

Since
0.01.0

Function Documentation

◆ SQR() [1/5]

static int SQR ( int  x)
inlinestatic

Inline function for squaring integers.

Parameters
[in]xint number to be squared
Returns
Squared number.
Since
0.01.0

◆ SQR() [2/5]

static short SQR ( short  x)
inlinestatic

Inline function for squaring shorts.

Parameters
[in]xshort number to be squared
Returns
Squared number.
Since
0.01.0

◆ SQR() [3/5]

static long SQR ( long  x)
inlinestatic

Inline function for squaring longs.

Parameters
[in]xlong number to be squared
Returns
Squared number.
Since
0.01.0

◆ SQR() [4/5]

static float SQR ( float  x)
inlinestatic

Inline function for squaring floats.

Parameters
[in]xfloat number to be squared
Returns
Squared number.
Since
0.01.0

◆ SQR() [5/5]

static double SQR ( double  x)
inlinestatic

Inline function for squaring doubles.

Parameters
[in]xdouble number to be squared
Returns
Squared number.
Since
0.01.0