28.2.60 __builtin_sacr

Description

Shifts value by shift and returns the value which is rounded using the rounding mode determined by the CORCONbits.RND control bit.

For example:

 volatile register int16_t value asm("A");
 int16_t result;

 result = __builtin_sacr(value,3);

Might generate:

 sac.r A, #3, w0

Prototype

int16_t __builtin_sacr(int16_t value, int16_t shift);

Arguments

value – Integer number to be shifted.

shift – Literal amount to shift between -8 and 7

Return Value

Returns the shifted result to CORCON register.

Machine Instruction

sacr

Error Messages

An error message will be displayed if:
  • the result is not an accumulator register
  • the shift value is not a literal within range