Basetypes

Types:

typedef signed int geBoolean;
#define GE_FALSE (0)
#define GE_TRUE  (1)

typedef float geFloat;

#ifndef NULL
#define NULL ((void *)0)
#endif

typedef signed long     int32;

typedef signed short    int16;

typedef signed char     int8 ;

typedef unsigned long  uint32;

typedef unsigned short uint16;

typedef unsigned char  uint8 ;

Macros:

#define GE_ABS(x)

Computes the absolute value of x.
#define GE_CLAMP(x,lo,hi)
If x is less than lo, lo is returned, otherwise if x is greater than hi, hi is returned, otherwise x is returned.  In other words x is "clamped" between hi and lo.


#define GE_CLAMP8(x)

This is an 8-bit unsigned (0-255) clamp.  See GE_CLAMP above for more information.


#define GE_CLAMP16(x)

This is a 16-bit unsigned (0-65536) clamp.  See GE_CLAMP above for more information


#define GE_BOOLSAME(x,y)

This returns True if x and y are both true or both false, otherwise it returns False.


#define GE_EPSILON    ((geFloat)0.000797f)

If two floating point values differ by this constant or less then they are considered equivalent per the definition of GE_FLOATS_EQUAL shown below.  Thanks to Raul Beltran for clarifying and confirming my suspicions about this.  I'm still uncertain what the derivation of the specific value is.


#define GE_FLOATS_EQUAL(x,y) ( GE_ABS((x) - (y)) < GE_EPSILON )

This appears to define 2 floats (x,y) equal if they only differ by EPSILON as defined above.


#define GE_FLOAT_ISZERO(x)  GE_FLOATS_EQUAL(x,0.0f)

This defines a float as being "equal" to zero if it only differs from zero by EPSILON as define above.


#define GE_PI     ((geFloat)3.14159265358979323846f)

A value to use for pi.