Miscellaneous scalar API#

group scalar_misc_api

Functions

static inline unsigned u32_ceil_log2(unsigned N)#

Get the size of a 32-bit unsigned number.

This function reports the size of the number as \(a\) , the number of bits required to store unsigned integer \(N\) . This is equivalent to \( ceil\left(log_2\left(N\right)\right) \).

N is the input \(N\) .

Operation Performed

\[\begin{split}\begin{aligned} a \leftarrow \begin{cases} 0 & N = 0 \\ \lceil log_2\left( N \right) \rceil & otherwise \end{cases} \end{aligned}\end{split}\]

Parameters:
  • N[in] Number to get the size of

Returns:

Number of bits \(a\) required to store \(N\)

int32_t s64_to_s32(exponent_t *a_exp, const int64_t b, const exponent_t b_exp)#

Convert a 64-bit floating-point scalar to a 32-bit floating-point scalar.

Converts a 64-bit floating-point scalar, represented by the 64-bit mantissa b and exponent b_exp, into a 32-bit floating-point scalar, represented by the 32-bit returned mantissa and output exponent a_exp.

Parameters:
  • a_exp[out] Output exponent

  • b[in] 64-bit input mantissa

  • b_exp[in] Input exponent

Returns:

32-bit output mantissa