dquakeplus/source/libpspmath/vfpu_fmodf.c
2022-02-08 16:49:56 -05:00

18 lines
437 B
C

#include "pspmath.h"
float vfpu_fmodf(float x, float y) {
float result;
// return x-y*((int)(x/y));
__asm__ volatile (
"mtv %2, S001\n"
"mtv %1, S000\n"
"vrcp.s S002, S001\n"
"vmul.s S003, S000, S002\n"
"vf2iz.s S002, S003, 0\n"
"vi2f.s S003, S002, 0\n"
"vmul.s S003, S003, S001\n"
"vsub.s S000, S000, S003\n"
"mfv %0, S000\n"
: "=r"(result) : "r"(x), "r"(y));
return result;
}