28.2.76 __builtin_min

Architecture

dsPIC33C/E/F, dsPIC30

Description

Force (Signed) Data Range Minimum Limit. Compares a 16-bit signed data value to a minimum signed limit value, both stored in the accumulators.

If the data value is less than the minimum, the data value is set to the minimum value.

If the data value is greater than or equal to the minimum value, the data value is not changed.

Prototype

int16_t __builtin_min(int16_t value, int16_t low);

Arguments

value – Data value

low – Minimum limit value

Return Value

Returns value limited by low.

Machine Instruction

min

Error Messages

None

Example

Assume Accumulator Register A contains 5

Assume Accumulator Register B contains 7

volatile register int accumA asm("A");
volatile register int accumB asm("B");
accumA = __builtin_min(accumA, accumB);

In assembly:

min A

For this example, the value in A will be 7, since A was less than the min value in B.