Merge pull request #20 from n00b87/performance_boost

Replaced loop to read numbers from code/data segments with a single cast
This commit is contained in:
Rodney Cunningham
2024-11-15 23:36:36 -05:00
committed by GitHub
3 changed files with 14 additions and 20 deletions

View File

@@ -661,23 +661,17 @@ bool rcbasic_load(std::string filename)
} }
uint64_t readInt() uint64_t readInt()
{ {
for(int i = 0; i < sizeof(uint64_t); i++) readint_val.i = ((uint64_t*)&segment[current_segment][current_address] )[0];
{ current_address += sizeof(uint64_t);
readint_val.data[i] = segment[current_segment][current_address]; return readint_val.i;
current_address++;
}
return readint_val.i;
} }
double readDouble() double readDouble()
{ {
for(int i = 0; i < sizeof(double); i++) readdouble_val.f = ((double*)&segment[current_segment][current_address] )[0];
{ current_address += sizeof(double);
readdouble_val.data[i] = segment[current_segment][current_address]; return readdouble_val.f;
current_address++;
}
return readdouble_val.f;
} }
void dbg_1(uint32_t dbg_fn, uint64_t arg1, uint64_t arg2) void dbg_1(uint32_t dbg_fn, uint64_t arg1, uint64_t arg2)

View File

@@ -2,7 +2,7 @@
#define RC_OS_DEFINES_H_INCLUDED #define RC_OS_DEFINES_H_INCLUDED
//USED FOR TESTING ONLY //USED FOR TESTING ONLY
//#define RC_TESTING #define RC_TESTING
//I am checking Android first since I think it also defines __linux__ //I am checking Android first since I think it also defines __linux__

View File

@@ -1,5 +1,5 @@
# depslib dependency file v1.0 # depslib dependency file v1.0
1731722537 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp 1731729523 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp
"rc_os_defines.h" "rc_os_defines.h"
<emscripten.h> <emscripten.h>
<sys/param.h> <sys/param.h>
@@ -32,7 +32,7 @@
<irrtheora.h> <irrtheora.h>
"rc_func130_cases.h" "rc_func130_cases.h"
1731726964 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h 1731728855 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
<TargetConditionals.h> <TargetConditionals.h>
1731722537 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h 1731722537 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
@@ -1247,7 +1247,7 @@
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h 1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
<irrlicht.h> <irrlicht.h>
1731722537 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h 1731729912 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
"SDL.h" "SDL.h"
<SDL2/SDL.h> <SDL2/SDL.h>
<irrlicht.h> <irrlicht.h>
@@ -1271,7 +1271,7 @@
"rc_joints.h" "rc_joints.h"
<irrtheora.h> <irrtheora.h>
1731727042 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx_core.h 1731727404 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx_core.h
"SDL.h" "SDL.h"
"btBulletDynamicsCommon.h" "btBulletDynamicsCommon.h"
"BulletSoftBody/btSoftRigidDynamicsWorld.h" "BulletSoftBody/btSoftRigidDynamicsWorld.h"
@@ -2517,7 +2517,7 @@
1731722537 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_physics3D_base.h 1731722537 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_physics3D_base.h
"rc_gfx_core.h" "rc_gfx_core.h"
1731725236 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_base_actor.h 1731727404 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_base_actor.h
1731710840 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_actor_material.h 1731710840 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_actor_material.h