shrtNs

Arithmetic shift of 16-bit value by a specified shift amount. If the shift count is positive, a right shift is performed. Otherwise, a left shift is performed. Saturation does not occur during a left shift. When an accumulator is the destination, zeroes out the LSP portion.

Note: Ignores upper N-5 bits of s_shftamount except the sign bit (MSB). If s_shftamount is positive and the value in the lower 5 bits of s_shftamount is greater than 15, the result is 0 if sval2shft is positive, and 0xFFFF if sval2shft is negative. If s_shftamount is negative and the absolute value in the lower 5 bits of s_shftamount is greater than 15, the result is 0.
Prototype

  Word16 shrtNs(Word16 sval2shft, Word16 s_shftamount)

  

  
Example
short result;

short s1 = 0x2468;

short s2= 1;



result = shrtNs(s1,s2);

// Expected value of result: 0x1234