
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
446 of 487
NXP Semiconductors
UM10800
Chapter 32: LPC82x ROM API integer divide routines
32.4 API description
The integer division routines perform arithmetic integer division operations and can be
called in the application code through simple API calls.
The following function prototypes are used:
typedef struct {
int quot;
/*!< Quotient */
int rem;
/*!< Remainder */
} IDIV_RETURN_T;
typedef struct {
unsigned quot; /*!< Quotient */
unsigned rem; /*!< Reminder */
} UIDIV_RETURN_T;
typedef struct {
int (*sidiv)(int numerator, int denominator); /*!< Signed integer division */
unsigned (*uidiv)(unsigned numerator, unsigned denominator); /*!< Unsigned
integer division */
IDIV_RETURN_T (*sidivmod)(int numerator, int denominator); /*!< Signed integer
division with remainder */
UIDIV_RETURN_T (*uidivmod)(unsigned numerator, unsigned denominator); /*!<
Unsigned integer division
with
remainder
*/
} ROM_DIV_API_T;
ROM_DIV_API_T const *pROMDiv = LPC_ROM_API->divApiBase;
The ROM API table shown in
Section 3.5.2 “ROM-based APIs”
must be included in the
code.
32.4.1 DIV signed integer division
Table 399. Divide API calls
API call
Description
Reference
int(*sdiv) (int numerator, int denominator);
Signed integer division
unsigned (*udiv) (int numerator, int denominator);
Unsigned integer division
sdiv_t (*sdivmod) (int numerator, int denominator);
Signed integer division with remainder
udiv_t (*udivmod)(unsigned numerator, unsigned
denominator);
Unsigned integer division with remainder
Table 400. sidiv
Routine
sidiv
Prototype
int(*sidiv) (int32_t numerator, int32_t denominator);