28.2.78 __builtin_min_excess

Architecture

dsPIC33C/E/F, dsPIC30

Description

Force (Signed) Data Range Minimum Limit with Limit Excess Direction. Compares a 16-bit signed data value to a minimum signed limit value and updates flag if excess.

Prototype

int16_t __builtin_min_excess(int16_t value, int16_t low, int16_t *flag_excess);

Arguments

value – Data value

low – Minimum limit value

flag_excess – 1 if data subceeds (is less than) limit, else 0

Return Value

Returns value limited by low.

Updates flag_excess value to 1 if data value subceeds the min limit value, else set to 0.

Machine Instruction

min

Error Messages

None

Example

Assume Accumulator Register A contains 3

Assume Accumulator Register B contains 5

volatile register int accumA asm("A");
volatile register int accumB asm("B");
int16_t flag_excess;
accumA = __builtin_min_excess(accumA, accumB, &flag_excess);

In assembly:

min A,[flag_excess]

For this example, the value in A will be 5, since A is less than the min value in B. The flag_excess will be set to 1, to indicate that the data value subceeds the min limit value.