# Arithmetic Functions (MATH) API Functions

### Utility Functions

MATH_IAbs | Returns an int-type argument's absolute value. (Inline function)
MATH_IMin | Compares two int-type arguments and returns the smaller. (Inline function)
MATH_IMax | Compares two int-type arguments and returns the larger. (Inline function)
MATH_ABS | Returns an argument's absolute value ( Function macro - has side effects)
MATH_MIN | Compares two numbers and returns the smaller. (Function macro - has side effects)
MATH_MAX | Compares two numbers and returns the larger. (Function macro - has side effects)
MATH_CLAMP | Returns the value of the first argument fit into the range of low to high. (Function macro - has side effects)
MATH_ROUNDUP | Returns the value of 1st argument rounded up to the multiple of 2nd argument. (Function macro)
MATH_ROUNDDOWN | Returns the value of 1st argument rounded down to the multiple of 2nd argument. (Function macro)
MATH_ROUNDUP32 | Returns value of argument rounded up to a multiple of 32. (Function macro)
MATH_ROUNDDOWN32 | Returns value of argument rounded down to a multiple of 32. (Function macro)

### Integer Operations

MATH_ILog2 | Returns the integer portion of the log base 2 of a `u32` value.

### Bit Operations

MATH_CountLeadingZeros | Gets the number of 0s from the start, expressed in a binary 32-bit value.
MATH_CLZ | A different name for `MATH_CountLeadingZeros`.
MATH_CountTrailingZeros | Gets the number of 0s from the end, expressed in a binary 32-bit value.
MATH_CTZ | A different name for `MATH_CountTrailingZeros`.
MATH_GetLeastSignificantBit | Gets the lowest order bit set to 1, expressed in a binary 32-bit value.
MATH_LSB | A different name for `MATH_GetLeastSignificantBit`.
MATH_GetMostSignificantBit | Gets the highest order bit set to 1, expressed in a binary 32-bit value.
MATH_MSB | A different name for `MATH_GetMostSignificantBit`.
MATH_CountPopulation | Gets the number of `1` bits, expressed in binary 32bit.

### Random Number-Related Features

MATH_InitRand* | Initializes random number generated by linear congruential method.
MATH_Rand* | Gets random number generated by linear congruential method.
MATHRandContext* | The context structure of a random number generated by linear congruential method.

### Sort-Related Functions

MATH_QSort | Performs quicksort.
MATH_QSortStackSize | Gets the buffer size required for a quicksort.
MATHCompareFunc | Comparison function type that is set when using quicksort.

### Fast Fourier Transforms

MATH_MakeFFTSinTable | This creates the sine value table for the fast Fourier transform.
MATH_FFT | This applies the fast Fourier transform on complex number sequences.
MATH_IFFT | This applies the inverse fast Fourier transform on the complex number sequences.
MATH_FFTReal | This applies the fast Fourier transform on the real number sequences.
MATH_IFFTReal | This performs the inverse fast Fourier transform on the real number sequence.

### Hash Value-Related Functions

MATH_Checksum*Init | Initializes the context structure for calculation of hash values based on checksums.
MATH_Checksum*Update | Updates the hash value based on checksums with the input data.
MATH_Checksum*GetHash | Gets the hash value based on checksums from the context structure.
MATHChecksum*Context | The context structure used for calculating hash based on checksums.
MATH_CalcChecksum* | The function that calculates hash value based on checksums using one function.
MATH_CRC*InitTable | Initializes the table used for calculating hash value based on CRCs.
MATH_CRC*Init | Initializes the context structure for calculation of hash values based on CRCs.
MATH_CRC*Update | Updates the hash value based on CRCs with the input data.
MATH_CRC*GetHash | Gets the hash value based on CRCs from the context structure.
MATHCRC*Table | The table structure used for calculating hash values based on CRCs.
MATHCRC*Context | The context structure used for calculating hash based on CRCs.
MATH_CalcCRC* | The utility function that calculates hash values based on CRCs using one function.

### Message Digest-Related Functions

MATH_MD5Init | Initializes the context structure used for message digest calculation based on MD5.
MATH_MD5Update | Updates the MD5-based message digest value using input data.
MATH_MD5GetHash | Gets the MD5-based message digest value from the context structure.
MATHMD5Context | The context structure used for message digest calculation based on MD5.
MATH_CalcMD5 | Utility function that calculates message digest values based on MD5 using one function.
MATH_SHA1Init | Initializes the context structure used for message digest calculation based on SHA1.
MATH_SHA1Update | Updates the SHA1-based message digest value using input data.
MATH_SHA1GetHash | Gets the SHA1-based message digest value from the context structure.
MATHSHA1Context | The context structure used for message digest calculation based on SHA1.
MATH_CalcSHA1 | Utility function that calculates message digest values based on SHA1 using one function.
MATH_CalcHMACMD5 | Calculates keyed hash values based on HMAC-MD5.
MATH_CalcHMACSHA1 | Calculates keyed hash values based on HMAC-SHA1.