You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
replace abs with c macro; replace round with asm extern function (#647)
Co-authored-by: someone2639 <someone2639@gmail.com>
This commit is contained in:
10
asm/round.s
Normal file
10
asm/round.s
Normal file
@@ -0,0 +1,10 @@
|
||||
.include "macros.inc"
|
||||
.section .text
|
||||
.set noreorder
|
||||
|
||||
.set abi_arg0, $f12
|
||||
|
||||
glabel roundf
|
||||
round.w.s $f0, abi_arg0
|
||||
jr $ra
|
||||
mfc1 $v0, $f0
|
||||
1
sm64.ld
1
sm64.ld
@@ -160,6 +160,7 @@ SECTIONS
|
||||
#ifdef EEP
|
||||
KEEP(BUILD_DIR/asm/vc_bin.o(.text*));
|
||||
#endif
|
||||
KEEP(BUILD_DIR/asm/round.o(.text*));
|
||||
|
||||
BUILD_DIR/src/boot*.o(.text*);
|
||||
BUILD_DIR/src/hvqm*.o(.text*);
|
||||
|
||||
@@ -451,27 +451,13 @@ extern f32 gSineTable[];
|
||||
|
||||
#define ABS(x) (((x) > 0) ? (x) : -(x))
|
||||
|
||||
/// From Wiseguy
|
||||
ALWAYS_INLINE s32 roundf(f32 in) {
|
||||
f32 tmp;
|
||||
s32 out;
|
||||
__asm__("round.w.s %0,%1" : "=f" (tmp) : "f" (in ));
|
||||
__asm__("mfc1 %0,%1" : "=r" (out) : "f" (tmp));
|
||||
return out;
|
||||
}
|
||||
extern s32 roundf(f32);
|
||||
// backwards compatibility
|
||||
#define round_float(in) roundf(in)
|
||||
|
||||
/// Absolute value
|
||||
ALWAYS_INLINE f32 absf(f32 in) {
|
||||
f32 out;
|
||||
__asm__("abs.s %0,%1" : "=f" (out) : "f" (in));
|
||||
return out;
|
||||
}
|
||||
ALWAYS_INLINE s32 absi(s32 in) {
|
||||
return ABS(in);
|
||||
}
|
||||
#define abss absi
|
||||
#define absf ABS
|
||||
#define absi ABS
|
||||
#define abss ABS
|
||||
|
||||
#define FLT_IS_NONZERO(x) (absf(x) > NEAR_ZERO)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user