Hi Flatmush,
thanks for the source, althrough I have seen most of it already in libpspmath, but together with some other examples it's a good reference to mips/vfpu asm.
It may be even more optimal and accurate to do this function in fixed point on the MIPS itself, depending on the range your data lies within.
Yes I did this before (~8 years ago) in my Java engine, but personally I prefer using float instead of writing a fix point math library again.
[EDIT]
The inline asm looks very similar to the inline asm I used reliably in funclib, are you certain that it's the asm which crashes?
well not 100%, but if I use my c/c++ implementationit doesn't crash, if you know the perlin noice code you see he uses three defines
#define s_curve(t) ( t * t * (3. - 2. * t) )
#define lerp(t, a, b) ( a + t * (b - a) )
#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
so I added/modified the code a little bit, something like
#ifndef _ASM_PERLIN
#define s_curve(t) ( t * t * (3. - 2. * t) )
#define lerp(t, a, b) ( a + t * (b - a) )
#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
#else
#define s_curve(t) SmoothCurve(t)
#define lerp(t, a, b) LinearInterpolate(t,a,b)
#define at3(q,rx,ry,rz) Dot3(q,rx,ry,rz)
#endif
[EDIT2]
I turned on my assert/debug handler and added some bounds check in the code, and now it doesn't crash, so I really think my crash is a syncing/timing issue (Note: in debug my optimize level is still set to -03, I only add some internal type checks, bounds check, asserts, logging, etc)
[EDIT3]
I saw my sub-threads didn't use PSP_THREAD_ATTR_VFPU, so I fixed it but I still have the crash ;(
Noware