1.4.4.57 libq_q31_ShiftRightR_q31_i16 Function

Arithmetic RIGHT Shift on a 32-bit value

Description

Function libq_q31_ShiftRightR_q31_q15:

Performs an Arithmetic RIGHT Shift on a 32-bit input by b bits with Rounding applied. The rounding occurs before any shift by adding a bit weight of "1/2 Lsb", where the "Lsb" is the Ending (shifted) Lsb. For example: The initial Bit#(i+b) is after the right shift Bit#(i), so the rounding bit weight is Bit#(i+b-1). Rounding does not occur on left shifts, when b is negative. After rounding, this function calls the right-shift function to perform the actual 32-bit right shift. 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 32-bit left shift. This function does not provide any status-type flag to indicate occurence of overflow.

positive value: # of bits to right shift (sign extend)

negative value: # of bits to left shift (zeros inserted at LSBs)

This function relates to the ETSI L_shr_r function.

Parameters

q31 a 32-bit signed integer value to be shifted

i16 b 16-bit signed integer shift index

Returns

q31 result - Arithmetically shifted 32-bit signed integer output

C

q31 libq_q31_ShiftRightR_q31_i16 (q31, i16);