_Q16shr Function

This function shifts a Q16 value by y bits, to the right if y is positive or to the left if y is negative. The function takes care of saturating the result, in case of underflow or overflow.

Include

<libq.h>

Prototype

_Q16 _Q16shr(_Q16 x, short y);

Arguments

x a fixed-point number in Q16 format. The value of this argument ranges from -2147483648 to 2147483647.
y an integer number, which ranges from -32 to 32.

Return Value

This function returns the shifted value of x in Q16 format. The value ranges from -2147483648 to 2147483647.