XS3 Util Functions and Macros

static inline unsigned cls(const int32_t a)

Count leading sign bits of int32_t.

This function returns the number of most-significant bits in a which are equal to its sign bit.

Note

This is the total number of leading sign bits, not redundant leading sign bits.

Parameters

a[in] Input value

Returns

Number of leading sign bits of a

MAX(A, B)

Takes the greater of arguments A and B, preferring A on equality.

Note

This is not safe from multiple evaluation of arguments.

Parameters
  • A[in] First input

  • B[in] Second input

Returns

Maximum of the inputs.

MIN(A, B)

Takes the lesser of arguments A and B, preferring A on equality.

Note

This is not safe from multiple evaluation of arguments.

Parameters
  • A[in] First input

  • B[in] Second input

Returns

Minimum of the inputs.

CLS_S16(X)

Count leading sign bits of an int16_t.

Parameters
  • X[in] Input

Returns

Leading sign bits of X

CLS_S32(X)

Count leading sign bits of an int32_t.

Parameters
  • X[in] Input

Returns

Leading sign bits of X

CLS_S64(X)

Count leading sign bits of an int64_t.

Parameters
  • X[in] Input

Returns

Leading sign bits of X

CLS_C16(X)

Count leading sign bits of a complex_s16_t.

The number of leading sign bits for a complex integer is defined as the minimum of the number of leading sign bits for its real part and for its imaginary part.

Parameters
  • X[in] Input

Returns

Leading sign bits of X

CLS_C32(X)

Count leading sign bits of a complex_s32_t.

The number of leading sign bits for a complex integer is defined as the minimum of the number of leading sign bits for its real part and for its imaginary part.

Parameters
  • X[in] Input

Returns

Leading sign bits of X

HR_S64(X)

Get the headroom of an int64_t.

Parameters
  • X[in] Input

Returns

Headroom of X

HR_S32(X)

Get the headroom of an int32_t.

Parameters
  • X[in] Input

Returns

Headroom of X

HR_S16(X)

Get the headroom of an int16_t.

Parameters
  • X[in] Input

Returns

Headroom of X

HR_C32(X)

Get the headroom of a complex_s32_t.

The headroom of a complex N-bit integer is the minimum of the headroom of each of its N-bit real and imaginary parts.

Parameters
  • X[in] Input

Returns

Headroom of X

HR_C16(X)

Get the headroom of a complex_s16_t.

The headroom of a complex N-bit integer is the minimum of the headroom of each of its N-bit real and imaginary parts.

Parameters
  • X[in] Input

Returns

Headroom of X