LIBML  Version 3.2.4
LIBML DSP Software Library
Functions
Vector Shift
Collaboration diagram for Vector Shift:

Functions

void tpt_shift_q15 (q15_t *aOutData, const q15_t *aInData, int8_t aShiftBits, uint32_t aCount)
 Shifts the elements of a Q15 vector a specified number of bits. More...
 
void tpt_shift_q31 (q31_t *aOutData, const q31_t *aInData, int8_t aShiftBits, uint32_t aCount)
 Shifts the elements of a Q15 vector a specified number of bits. More...
 
void tpt_shift_q7 (q7_t *aOutData, const q7_t *aInData, int8_t aShiftBits, uint32_t aCount)
 Shifts the elements of a Q7 vector a specified number of bits. More...
 

Detailed Description

Shifts the elements of a fixed-point vector by a specified number of bits. There are separate functions for Q7, Q15, and Q31 data types. The underlying algorithm used is:

    aOutData[n] = aInData[n] << aShiftBits,     0 <= n < aCount.
  

If aShiftBits is positive then the elements of the vector are shifted to the left. If aShiftBits is negative then the elements of the vector are shifted to the right.

The functions support in-place computation allowing the source and destination pointers to reference the same memory buffer.

Function Documentation

◆ tpt_shift_q15()

void tpt_shift_q15 ( q15_t aOutData,
const q15_t aInData,
int8_t  aShiftBits,
uint32_t  aCount 
)

Shifts the elements of a Q15 vector a specified number of bits.

Parameters
[out]aOutDatapoints to the output vector.
[in]aInDatapoints to the input vector.
[in]aShiftBitsnumber of bits to shift. A positive value shifts left; a negative value shifts right.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function uses saturating arithmetic. Results outside of the allowable Q15 range [0x8000 0x7FFF] are saturated.

◆ tpt_shift_q31()

void tpt_shift_q31 ( q31_t aOutData,
const q31_t aInData,
int8_t  aShiftBits,
uint32_t  aCount 
)

Shifts the elements of a Q15 vector a specified number of bits.

Parameters
[out]aOutDatapoints to the output vector
[in]aInDatapoints to the input vector
[in]aShiftBitsnumber of bits to shift. A positive value shifts left; a negative value shifts right.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function uses saturating arithmetic. Results outside of the allowable Q31 range [0x80000000 0x7FFFFFFF] are saturated.

◆ tpt_shift_q7()

void tpt_shift_q7 ( q7_t aOutData,
const q7_t aInData,
int8_t  aShiftBits,
uint32_t  aCount 
)

Shifts the elements of a Q7 vector a specified number of bits.

Parameters
[out]aOutDatapoints to the output vector
[in]aInDatapoints to the input vector
[in]aShiftBitsnumber of bits to shift. A positive value shifts left; a negative value shifts right.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function uses saturating arithmetic. Results outside of the allowable Q7 range [0x80 0x7F] are saturated.