Util Function Match

Matched FFloatsNear in Util.c
This commit is contained in:
Lol Bozo 2024-07-21 22:39:51 -04:00
parent df3946a112
commit 8268ade33d
3 changed files with 18 additions and 3 deletions

View File

@ -625,7 +625,7 @@ SmoothMatrix = 0x1EA918; // type:func
NRandInRange__Fii = 0x1EAA70; // type:func
GRandInRange = 0x1EAAE0; // type:func
GRandGaussian = 0x1EAB48; // type:func
FFloatsNear = 0x1EAC68; // type:func
FFloatsNear__Ffff = 0x1EAC68; // type:func
CSolveQuadratic = 0x1EACA0; // type:func
PrescaleClq = 0x1EAD30; // type:func
CalculateSinCos__FfPfT1 = 0x1EAD88; // type:func

View File

@ -29,7 +29,7 @@ PRE_ELF_PATH = f"{OUTDIR}/{BASENAME}.elf"
COMMON_INCLUDES = "-Iinclude -isystem include/sdk/ee -isystem include/gcc"
CC_DIR = f"{TOOLS_DIR}/cc/bin"
COMMON_COMPILE_FLAGS = "-x c++ -V 2.95.2 -O2 -G0"
COMMON_COMPILE_FLAGS = "-x c++ -V 2.95.2 -O2 -G0 -ffast-math"
WINE = "wine"

View File

@ -49,7 +49,22 @@ INCLUDE_ASM(const s32, "P2/util", GRandInRange);
INCLUDE_ASM(const s32, "P2/util", GRandGaussian);
INCLUDE_ASM(const s32, "P2/util", FFloatsNear);
int FFloatsNear(float g1,float g2,float gEpsilon)
{
float x = 1.0f;
g2 = g1-g2;
g1 = g1 > 0.0f ? g1 : -g1;
g2 = g2 > 0.0f ? g2 : -g2;
x = g1 > x ? g1 : x;
g2 = g2 / x;
if(g2 < gEpsilon)
{
return 1;
}
return 0;
}
INCLUDE_ASM(const s32, "P2/util", CSolveQuadratic);