Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/RSBE01_02/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ sora/gf/gf_monitor.cpp:
sora/gf/gf_resource_loader.cpp:
.text start:0x8003D864 end:0x8003DB08

sora/mt/mt_common.cpp:
.text start:0x8003DB08 end:0x8003DBA8
.sdata2 start:0x805A16F8 end:0x805A1708

sora/mt/mt_vector.cpp:
.text start:0x8003DBA8 end:0x8003E244
.sdata2 start:0x805A1708 end:0x805A1728
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ def NW4RObject(completed, name, **options):
Object(Matching, "sora/gf/gf_capture_util.cpp"),
Object(Matching, "sora/gf/gf_monitor.cpp"),
Object(Matching, "sora/gf/gf_resource_loader.cpp"),
Object(Matching, "sora/mt/mt_common.cpp"),
Object(Matching, "sora/mt/mt_vector.cpp"),
Object(Matching, "sora/mt/mt_vector_old.cpp"),
Object(Matching, "sora/mt/mt_prng.cpp", extra_cflags=["-RTTI off"]),
Expand Down
36 changes: 36 additions & 0 deletions src/sora/mt/mt_common.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <math.h>
#include <mt/mt_common.h>
#include <types.h>

float mtSqrtf(register float x) {
if (x > 0.0f) {
register float y;
#ifdef MATCHING
asm {
frsqrte y, x
}
#else
y = 1.0f / sqrtf(x);
#endif
y = 0.5f * y * (3.0f - x * (y * y));
y = 0.5f * y * (3.0f - x * (y * y));
return y * x;
}
return 0.0f;
}

float rsqrtf(register float x) {
if (x < FLT_EPSILON)
return 0.0f;
register float y;
#ifdef MATCHING
asm {
frsqrte y, x
}
#else
y = 1.0f / sqrtf(x);
#endif
y = 0.5f * y * (3.0f - x * (y * y));
y = 0.5f * y * (3.0f - x * (y * y));
return y;
}
Loading