Files
Gota7 ede2e3ada8 Decompile Most Of xVec3.cpp (#113)
* Decomp Part Of zMusic.cpp

Progress.

* Cleanup zMusic Changes

For merging.

* Partial Decompilation Of zTaxi.cpp

9/13 functions done.

* Decompile Most Of zCameraFly.cpp; Cleanup

More progress.

* zRumble, zFX, Snd zScript Partial Decpmpilation

More general progress.

* zRumble, zFX, And zScript Partial Decpmpilation

More general progress.

* Cleanup For Merging

For progress.

* Another Cleanup For Pull Request

3rd time's the charm.

* Partial Decompilation Of iTime.cpp

Progress!

* Decompile Most Of Particle Manager

So close to 100%ing it, but yet so far.

* Start xBehaviour; Remove zScript.s

I need sleep.

* More Work On xBehaviour

Progress.

* Partial Decompilation Of Various Files

Include xDebug, zPendulum, and zTaskBox. All work in progress.

* Partial Decompilation Of zMovePoint And zLightEffect

Progress.

* Partial Decompilation Of xGroup

Progress.

* Remove Nonexistent Link Variable

It doesn't exist.

* Decompile Most Of xRMemData

So close, yet so far...

* Fully Decompile xFog.cpp

But removing the ASM file doesn't work because of the float :{

* Random Progress Dump

A bunch of stuff that works or not.

* Partial Progress On xSurface.cpp

Progress.

* Decompile Most Of xBehaveGoalSimple

Decompile various files.

* Update website.yml

* Revert "Update website.yml"

This reverts commit 4c7926be16c5d38b675d990a44086a5061e736b3.

* Commit Fixes

For PR merging.

* Partial Progress For zNPCMgr

Progress is progress.

* Decompile Most Of xVec3

Have to love that inline assembly.
2021-01-12 07:32:06 -05:00

46 lines
1.8 KiB
C

#ifndef __FASTMATH_H__
#define __FASTMATH_H__
#include <types.h>
#define RET_REG fp1
#define V1_XY fp2
#define V1_Z fp3
#define V2_XY fp4
#define V2_Z fp5
#define D1_XY fp6
#define D1_Z fp7
#define D2_XY fp8
#define D2_Z fp9
#define W1_XY fp10
#define W1_Z fp11
#define W2_XY fp12
#define W2_Z fp13
typedef struct
{
float32 x, y, z;
} Vec;
// All this essentially does is do "*dst = *src;"
#define PSVECCopy(dst, src) \
asm {\
psq_l fp0, 0(src), 0, 0; /* Load src->x and src->y into fp0. */ \
psq_l fp1, 8(src), 1, 0; /* Load src->z only into fp1. */ \
psq_st fp0, 0(dst), 0, 0; /* Store fp0 into dst->x and dst->y. */ \
psq_st fp1, 8(dst), 1, 0; /* Store only the first half of fp1 into dst->z. */ \
}
// I can't figure out how to get this as a C-style inline function, so use this in an ASM function or block.
#define PSVECDotProduct(vec1, vec2) \
nofralloc; \
psq_l fp2, 4(vec1), 0, 0; \
psq_l fp3, 4(vec2), 0, 0; \
ps_mul fp2, fp2, fp3; \
psq_l fp5, 0(vec1), 0, 0; \
psq_l fp4, 0(vec2), 0, 0; \
ps_madd fp3, fp5, fp4, fp2; \
ps_sum0 fp1, fp3, fp2, fp2; \
blr;
#endif