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) |
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 }
float log2_table[LOG2_TABLE_SIZE] |
float pow2_table[POW2_TABLE_SIZE] |