u_math.c File Reference

Include dependency graph for u_math.c:

Go to the source code of this file.

Functions

static void init_pow2_table (void)
static void init_log2_table (void)
void util_init_math (void)
 One time init for math utilities.

Variables

float pow2_table [POW2_TABLE_SIZE]
 2^x, for x in [-1.0, 1.0)
float log2_table [LOG2_TABLE_SIZE]
 log2(x), for x in [1.0, 2.0)


Function Documentation

static void init_log2_table ( void   )  [static]

Definition at line 51 of file u_math.c.

References log2_table, LOG2_TABLE_SCALE, and LOG2_TABLE_SIZE.

00052 {
00053    unsigned i;
00054    for (i = 0; i < LOG2_TABLE_SIZE; i++)
00055       log2_table[i] = (float) log2(1.0 + i * (1.0 / LOG2_TABLE_SCALE));
00056 }

static void init_pow2_table ( void   )  [static]

Definition at line 38 of file u_math.c.

References pow(), pow2_table, POW2_TABLE_OFFSET, POW2_TABLE_SCALE, and POW2_TABLE_SIZE.

00039 {
00040    int i;
00041    for (i = 0; i < POW2_TABLE_SIZE; i++)
00042       pow2_table[i] = (float) pow(2.0, (i - POW2_TABLE_OFFSET) / POW2_TABLE_SCALE);
00043 }

void util_init_math ( void   ) 

One time init for math utilities.

Definition at line 63 of file u_math.c.

References FALSE, init_log2_table(), init_pow2_table(), and TRUE.

00064 {
00065    static boolean initialized = FALSE;
00066    if (!initialized) {
00067       init_pow2_table();
00068       init_log2_table();
00069       initialized = TRUE;
00070    }
00071 }


Variable Documentation

float log2_table[LOG2_TABLE_SIZE]

log2(x), for x in [1.0, 2.0)

Definition at line 47 of file u_math.c.

float pow2_table[POW2_TABLE_SIZE]

2^x, for x in [-1.0, 1.0)

Definition at line 34 of file u_math.c.


Generated on Tue Sep 29 06:25:28 2009 for Gallium3D by  doxygen 1.5.4