Most functions have several different signatures for uniform or varying values. A uniform value is the same for all elements of the vector arrays (i.e. a scalar value). A varying value is potentially different.
For example
void function(fpreal32 *a, fpreal32 *b, int nfloats) { // Use the mul operation to multiply a by a scalar/uniform value VM_Math::mul(a, a, 1.3); // Now, use the varying function to multiply by a vector/varying value VM_Math::mul(a, a, b); }
Most functions also have a SISD implementation which is illustrative of what the function actually does. The vector forms can be significantly faster than the SISD versions.
For example, to add one array of floats to another, instead of
void addFloats(float *a, const float *b, int nfloats) { int i; for (i = 0; i < nfloats; i++) a[i] += b[i]; }
void addFloats(float *a, const float *b, int nfloats) { VM_Math::add(a, a, b, nfloats); }
false values, but may return any other value for true values.
VM_Math::lt(d, a, b) VM_Math::fastlt(d, a, b) VM_Math::le(d, a, b) VM_Math::fastle(d, a, b) VM_Math::gt(d, a, b) VM_Math::fastgt(d, a, b) VM_Math::ge(d, a, b) VM_Math::fastge(d, a, b) VM_Math::eq(d, a, b) VM_Math::fasteq(d, a, b) VM_Math::ne(d, a, b) VM_Math::fastne(d, a, b) VM_Math::add(d, a, b) VM_Math::sub(d, a, b) VM_Math::mul(d, a, b) VM_Math::div(d, a, b) VM_Math::safediv(d, a, b) VM_Math::fdiv(d, a, b) VM_Math::max(d, a, b) VM_Math::min(d, a, b) VM_Math::clamp(d, a, b) VM_Math::dot(a,b,n) VM_Math::zerocount(a,n) VM_Math::scaleoffset(d, a, b) VM_Math::madd(d, a, b) VM_Math::sqrt(d, a) VM_Math::fsqrt(d, a) sqrt() since it uses the reciprocal function. VM_Math::isqrt(d, a) VM_Math::floor(a) VM_Math::cast(a) VM_Math::negate(d, a) VM_Math::invert(d, a) VM_Math::abs(d, a) VM_Math::wpoint(d,a,b,c,e) VM_Math::iwpoint(d,a,b,e) VM_Math::set(d, a) VM_Math::set(d, a, disabled) VM_Math::lerp(d, a, b, t)
1.5.9