Download "TMS320C6000 Optimizing C Compiler User's Guide"
Transcript
div/ldiv
div/ldiv
Syntax for C
Division
#include <stdlib.h>
div_t div(register int numer, register int denom);
ldiv_t ldiv(register long numer, register long denom);
Syntax for C++
#include <cstdlib>
div_t std::div(register int numer, register int denom);
ldiv_t std::ldiv(register long numer, register long denom);
Defined in
div.c in rts.src
Description
Two functions support integer division by returning numer (numerator) divided
by denom (denominator). You can use these functions to determine both the
quotient and the remainder in a single operation.
- The div function performs integer division. The input arguments are inte-
gers; the function returns the quotient and the remainder in a structure of
type div_t. The structure is defined as follows:
typedef struct
{
int quot;
int rem;
} div_t;
/* quotient
/* remainder
*/
*/
- The ldiv function performs long integer division. The input arguments are
long integers; the function returns the quotient and the remainder in a
structure of type ldiv_t. The structure is defined as follows:
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
/* quotient
/* remainder
*/
*/
The sign of the quotient is negative if either but not both of the operands is
negative. The sign of the remainder is the same as the sign of the dividend.
9-54
Related documents
TMS320C6000 Optimizing Compiler User's Guide (Rev. L)
TMS320C55x Optimizing C/C++ Compiler User's Guide
TMS320C6000 Optimizing Compiler v 7.4
TMS320C6000 Assembly Language Tools User's Guide
"TMS320C3x/C4x Optimizing C Compiler User's Guide"
Vodafone SS 08 User's Manual
User`s Manual for NEARCOM Diffractive, Unsteady Wave Driver DUNS
TMS320C3X/C4X CODE GENERATION TOOLS GETTING
Goanna Studio User Guide
MSP430 Optimizing C/C++ Compiler User`s Guide
TMS320C55x Optimizing C/C++ Compiler
SR-MK3-PRO User`s manual