1.4.4.41 libq_q15_ShiftRight_q15_i16 Function

Arithmetic RIGHT Shift on a 16-bit value.

Description

Function libq_q15_ShiftRight_q15_q15:

Performs an Arithmetic RIGHT Shift on a 16-bit input by b bit positions. 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 any 16-bit left shifts. This function does not provide any status-type information to indicate when overflows occur.

positive value: # of bits to right shift (sign extend) { To get all sign bits, b>=15 }

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

This function relates to the ETSI shr function.

Parameters

q15 a 16-bit signed input value to shift

i16 b 16-bit signed integer shift index

Returns

q15 result - 16-bit signed shifted output

C

q15 libq_q15_ShiftRight_q15_i16 (q15, i16);