1.4.4.42 libq_q15_ShiftRightR_q15_i16 Function
Performs an Arithmetic RIGHT Shift on a 16-bit input.
Description
Function libq_q15_ShiftRightR_q15_q15:
Performs an Arithmetic RIGHT Shift on a 16-bit input by b bits with Rounding applied. The rounding occurs by adding a bit weight of "1/2 Lsb", where the "Lsb" is the Ending (shifted) Lsb. For example: The initial Bit#(b) is after the right shift Bit#(0), so the rounding bit weight is Bit#(b-1). Rounding does not occur on either left shifts or on no shift needed cases. For positive shift directions (b>0), b Lsb-bits are shifted out to the right and b sign-extended Msb-bits fill in From the left. For negative shift directions (b<0), b Lsbs are shifted to the LEFT with 0s filling in the empty lsb position. The left shifting causes b Msb-bits to fall off to the left, saturation is applied to any shift left value that overflows. This function calls the left-shift function to perform the actual 16-bit left shift. This function does not provide any status-type information to indicate when overflows occur.
positive value: # of bits to right shift (sign extend) {b > 15, results in all sign bits}
negative value: # of bits to left shift (zeros inserted at LSBs)
This function relates to the ETSI shr_r function.
Parameters
q15 a 16-bit signed integer value to be shifted
i16 b 16-bit signed integer shift index
Returns
q15 result - Arithmetically shifted 16-bit signed integer output
C
q15 libq_q15_ShiftRightR_q15_i16 (q15, i16);