Pre-calculate pow table for FXTRACT instruction

This commit is contained in:
Cacodemon345
2025-03-20 21:52:48 +06:00
parent 00c97dac1c
commit a9c97abfb6
4 changed files with 14 additions and 1 deletions

View File

@@ -32,6 +32,7 @@
#include <wchar.h>
#include <stdatomic.h>
#include <unistd.h>
#include <math.h>
#ifndef _WIN32
# include <pwd.h>
@@ -233,6 +234,8 @@ extern int CPUID;
extern int output;
int atfullspeed;
extern double exp_pow_table[0x800];
char exe_path[2048]; /* path (dir) of executable */
char usr_path[1024]; /* path (dir) of user data */
char cfg_path[1024]; /* full path of config file */
@@ -1086,6 +1089,11 @@ pc_init_modules(void)
machine_status_init();
for (c = 0; c <= 0x7ff; c++) {
int64_t exp = c - 1023; /* 1023 = BIAS64 */
exp_pow_table[c] = pow(2.0, (double) exp);
}
if (do_nothing) {
do_nothing = 0;
exit(-1);