mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2024-11-29 15:11:54 +00:00
17 lines
459 B
C
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;
|
|
}
|