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

17 lines
459 B
C

#include "pspmath.h"
float vfpu_randf(float min, float max) {
float result;
__asm__ volatile (
"mtv %1, S000\n"
"mtv %2, S001\n"
"vsub.s S001, S001, S000\n"
"vrndf1.s S002\n"
"vone.s S003\n"
"vsub.s S002, S002, S003\n"
"vmul.s S001, S002, S001\n"
"vadd.s S000, S000, S001\n"
"mfv %0, S000\n"
: "=r"(result) : "r"(min), "r"(max));
return result;
}