28.2.52 __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 int value asm("A");
 int result;

 result = __builtin_sacr(value,3);

Might generate:

sac.r A, #3, w0

Prototype

int __builtin_sacr(int value, int shift);

Argument

value – Integer number to be shifted.

shift – Literal amount to shift between -8 and 7

Return Value

Returns the shifted result to CORCON register.

Assembler Operator/ 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