Miscellaneous Scalar API#

group scalar_misc_api


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{flalign*} a \leftarrow \begin{cases} 0 & N = 0 \\ \lceil log_2\left( N \right) \rceil & otherwise \end{cases} && \end{flalign*}\end{split}\]

  • N[in] Number to get the size of


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.

  • a_exp[out] Output exponent

  • b[in] 64-bit input mantissa

  • b_exp[in] Input exponent


32-bit output mantissa