OldSchool Library
Math

Macros

#define oslSrand   vfpu_srand
 Set the seed for the VFPU random number generator.
 
#define oslRandf   vfpu_randf
 Generate a random floating-point value.
 
#define oslRand_8888   vfpu_rand_8888
 Generate a random color value in 8888 format.
 
#define oslSinf   vfpu_sinf
 Calculate the sine of an angle.
 
#define oslCosf   vfpu_cosf
 Calculate the cosine of an angle.
 
#define oslTanf   vfpu_tanf
 Calculate the tangent of an angle.
 
#define oslAsinf   vfpu_asinf
 Calculate the inverse sine (arcsin) of a value.
 
#define oslAcosf   vfpu_acosf
 Calculate the inverse cosine (arccos) of a value.
 
#define oslAtanf   vfpu_atanf
 Calculate the inverse tangent (arctan) of a value.
 
#define oslAtan2f   vfpu_atan2f
 Calculate the inverse tangent of two values, with quadrant correction.
 
#define oslSinhf   vfpu_sinhf
 Calculate the hyperbolic sine of a value.
 
#define oslCoshf   vfpu_coshf
 Calculate the hyperbolic cosine of a value.
 
#define oslTanhf   vfpu_tanhf
 Calculate the hyperbolic tangent of a value.
 
#define oslSincos   vfpu_sincos
 Calculate both sine and cosine of an angle.
 
#define oslExpf   vfpu_expf
 Calculate the exponential of a value.
 
#define oslLogf   vfpu_logf
 Calculate the natural logarithm of a value.
 
#define oslPowf   vfpu_powf
 Calculate the power of a number.
 
#define oslFmodf   vfpu_fmodf
 Calculate the floating-point remainder of division.
 

Detailed Description

Mathematical functions utilizing the PSP's Vector Floating Point Unit (VFPU).

These functions provide efficient mathematical computations by leveraging the VFPU on the PSP. They are based on the libpspmath library (version 4) by MrMr[iCE].

Macro Definition Documentation

◆ oslSrand

#define oslSrand   vfpu_srand

Set the seed for the VFPU random number generator.

This function sets the initial seed value for generating random numbers using the VFPU random number generator.

Parameters
xThe seed value to initialize the random number generator.

◆ oslRandf

#define oslRandf   vfpu_randf

Generate a random floating-point value.

This function returns a random floating-point number between the specified minimum and maximum values using the VFPU.

Parameters
minThe minimum value that can be returned.
maxThe maximum value that can be returned.
Returns
A random floating-point number between min and max.

◆ oslRand_8888

#define oslRand_8888   vfpu_rand_8888

Generate a random color value in 8888 format.

This function returns a random color value in the 8888 format (8 bits per channel). The alpha channel is always set to 0xFF.

Parameters
minThe minimum value for each color channel (range: 0 to 255).
maxThe maximum value for each color channel (range: 0 to 255).
Returns
A random color value in 8888 format.

◆ oslSinf

#define oslSinf   vfpu_sinf

Calculate the sine of an angle.

This function returns the sine of the given angle (in radians) using the VFPU.

Parameters
xThe angle in radians.
Returns
The sine of the input angle.

◆ oslCosf

#define oslCosf   vfpu_cosf

Calculate the cosine of an angle.

This function returns the cosine of the given angle (in radians) using the VFPU.

Parameters
xThe angle in radians.
Returns
The cosine of the input angle.

◆ oslTanf

#define oslTanf   vfpu_tanf

Calculate the tangent of an angle.

This function returns the tangent of the given angle (in radians) using the VFPU.

Parameters
xThe angle in radians.
Returns
The tangent of the input angle.

◆ oslAsinf

#define oslAsinf   vfpu_asinf

Calculate the inverse sine (arcsin) of a value.

This function returns the inverse sine (arcsin) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The arcsin of the input value.

◆ oslAcosf

#define oslAcosf   vfpu_acosf

Calculate the inverse cosine (arccos) of a value.

This function returns the inverse cosine (arccos) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The arccos of the input value.

◆ oslAtanf

#define oslAtanf   vfpu_atanf

Calculate the inverse tangent (arctan) of a value.

This function returns the inverse tangent (arctan) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The arctan of the input value.

◆ oslAtan2f

#define oslAtan2f   vfpu_atan2f

Calculate the inverse tangent of two values, with quadrant correction.

This function returns the inverse tangent (arctan) of y/x using the VFPU, with correct quadrant determination.

Parameters
yThe y-coordinate.
xThe x-coordinate.
Returns
The arctan of the inputs, with quadrant correction.

◆ oslSinhf

#define oslSinhf   vfpu_sinhf

Calculate the hyperbolic sine of a value.

This function returns the hyperbolic sine (sinh) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The hyperbolic sine of the input value.

◆ oslCoshf

#define oslCoshf   vfpu_coshf

Calculate the hyperbolic cosine of a value.

This function returns the hyperbolic cosine (cosh) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The hyperbolic cosine of the input value.

◆ oslTanhf

#define oslTanhf   vfpu_tanhf

Calculate the hyperbolic tangent of a value.

This function returns the hyperbolic tangent (tanh) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The hyperbolic tangent of the input value.

◆ oslSincos

#define oslSincos   vfpu_sincos

Calculate both sine and cosine of an angle.

This function computes both the sine and cosine of the given angle (in radians) and stores the results in the provided pointers.

Parameters
rThe angle in radians.
sA pointer to store the sine of the angle.
cA pointer to store the cosine of the angle.

◆ oslExpf

#define oslExpf   vfpu_expf

Calculate the exponential of a value.

This function returns the exponential of the input value (e^x) using the VFPU.

Parameters
xThe input value.
Returns
The exponential of the input value.

◆ oslLogf

#define oslLogf   vfpu_logf

Calculate the natural logarithm of a value.

This function returns the natural logarithm (log base e) of the input value using the VFPU.

Parameters
xThe input value.
Returns
The natural logarithm of the input value.

◆ oslPowf

#define oslPowf   vfpu_powf

Calculate the power of a number.

This function returns the value of x raised to the power of y using the VFPU.

Parameters
xThe base value.
yThe exponent value.
Returns
The result of x raised to the power of y.

◆ oslFmodf

#define oslFmodf   vfpu_fmodf

Calculate the floating-point remainder of division.

This function returns the floating-point remainder of x/y using the VFPU.

Parameters
xThe numerator.
yThe denominator.
Returns
The floating-point remainder of x/y.