mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2024-11-22 11:51:21 +00:00
18 lines
437 B
C
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;
|
|
}
|