07.04.2013 Views

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

16-Bit C <strong>Compiler</strong> User’s Guide<br />

__builtin_divmodud<br />

Description: Issues the 16-bit architecture’s native unsigned divide support with the<br />

same restrictions given in the “<strong>dsPIC</strong>30F/33F Programmer’s Reference<br />

Manual” (DS70157). Notably, if the quotient does not fit into a<br />

16-bit result, the results (including remainder) are unexpected. This<br />

<strong>for</strong>m of the builtin function will capture both the quotient <strong>and</strong> remainder.<br />

Prototype: unsigned int __builtin_divmodud(<br />

unsigned long dividend, unsigned int divisor,<br />

unsigned int *remainder);<br />

Argument: dividendnumber to be divided<br />

divisornumber to divide by<br />

remainderpointer to remainder<br />

Return Value: Quotient <strong>and</strong> remainder.<br />

Assembler Opera- divmodud<br />

tor / Machine<br />

Instruction:<br />

Error Messages None.<br />

__builtin_divsd<br />

Description: Computes the quotient num / den. A math error exception occurs if den<br />

is zero. Function arguments are signed, as is the function result. The<br />

comm<strong>and</strong>-line option -Wconversions can be used to detect unexpected<br />

sign conversions.<br />

Prototype: int __builtin_divsd(const long num, const int den);<br />

Argument: num numerator<br />

den denominator<br />

Return Value: Returns the signed integer value of the quotient num / den.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

div.sd<br />

__builtin_divud<br />

Description: Computes the quotient num / den. A math error exception occurs if den<br />

is zero. Function arguments are unsigned, as is the function result. The<br />

comm<strong>and</strong>-line option -Wconversions can be used to detect unexpected<br />

sign conversions.<br />

Prototype: unsigned int __builtin_divud(const unsigned<br />

long num, const unsigned int den);<br />

Argument: num numerator<br />

den denominator<br />

Return Value: Returns the unsigned integer value of the quotient num / den.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

div.ud<br />

DS51284G-page 146 © 2008 <strong>Microchip</strong> Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!