Remove use of mwcc 1.3.2r compiler, inline funcs with a local static variable disable data/rodata respectively.

This commit is contained in:
Cuyler36
2024-11-09 19:44:33 -05:00
parent ab629d5659
commit 0696190e7c
4 changed files with 11 additions and 47 deletions
+4 -3
View File
@@ -242,7 +242,8 @@ cflags_foresta = [
"-sdata 0",
"-sdata2 0",
"-d IS_REL",
'-requireprotos',
"-requireprotos",
"-sym on",
]
config.linker_version = "GC/1.3.2"
@@ -275,7 +276,7 @@ def JSystemLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"mw_version": "GC/1.3.2r",
"mw_version": "GC/1.3.2",
"cflags": cflags_foresta,
"progress_category": "game",
"objects": objects,
@@ -766,7 +767,7 @@ config.libs = [
},
{
"lib": "Famicom",
"mw_version": "GC/1.3.2r",
"mw_version": "GC/1.3.2",
"cflags": [
*cflags_static,
"-sdata 0",
+2 -40
View File
@@ -1,9 +1,6 @@
#ifndef W_MATH_H
#define W_MATH_H
#include "types.h"
/* this is needed to keep $localstatic$ variables out of the rel */
#ifndef OPTIMIZED_SQRTF
extern inline float sqrtf(float x) {
static const double _half = .5;
static const double _three = 3.0;
@@ -18,41 +15,6 @@ extern inline float sqrtf(float x) {
}
return x;
}
#else
extern inline float sqrtf(float x) {
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = .5 * guess * (3.0 - guess * guess * x); // now have 12 sig bits
guess = .5 * guess * (3.0 - guess * guess * x); // now have 24 sig bits
guess = .5 * guess * (3.0 - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
#endif
// hack to get some functions matching where the static const locals are needed
// disabled until static const locals are resolved
/*
extern inline float sqrtf2(float x)
{
static const double _half=.5;
static const double _three=3.0;
volatile float y;
if(x > 0.0f)
{
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half*guess*(_three - guess*guess*x); // now have 12 sig bits
guess = _half*guess*(_three - guess*guess*x); // now have 24 sig bits
guess = _half*guess*(_three - guess*guess*x); // now have 32 sig bits
y=(float)(x*guess);
return y;
}
return x;
}
*/
extern inline double fabs(double x) {
return __fabs(x);
@@ -91,8 +53,8 @@ extern inline double sqrt(double x) {
extern "C" {
#endif
f64 atan2(f64, f64);
f64 acos(f32);
double atan2(double, double);
double acos(float);
#ifdef __cplusplus
}
+2
View File
@@ -1,6 +1,8 @@
#ifndef TYPES_H
#define TYPES_H
#include "MSL_C/w_math.h"
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
+3 -4
View File
@@ -25,7 +25,7 @@ const f64 pows[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L
#define _CSIGN 1
#define _ILONG 0
#define _MBMAX 8
#define NAN 2
#define NAN_2 2
#define INF 1
#define FINITE -1
#define _DFRAC ((1 << _DOFF) - 1)
@@ -159,14 +159,14 @@ s16 _Ldunscale(s16* pex, _Pft* px) {
if (xchar == _DMAX) { /* NaN or INF */
*pex = 0;
return (s16)(ps[_D0] & _DFRAC || ps[_D1] || ps[_D2] || ps[_D3] ? NAN : INF);
return (s16)(ps[_D0] & _DFRAC || ps[_D1] || ps[_D2] || ps[_D3] ? NAN_2 : INF);
} else if (0 < xchar) {
ps[_D0] = (ps[_D0] & ~_DMASK) | (_DBIAS << _DOFF);
*pex = xchar - (_DBIAS - 1);
return FINITE;
}
if (0 > xchar) {
return NAN;
return NAN_2;
} else {
*pex = 0;
return 0;
@@ -279,4 +279,3 @@ void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp) {
}
}
}