UM11029
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2017. All rights reserved.
User manual
Rev. 1.0 — 16 June 2017
486 of 515
NXP Semiconductors
UM11029
Chapter 30: LPC84x ROM API integer divide routines
30.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.
30.4.1 DIV signed integer division
Table 471. 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 472. sidiv
Routine
sidiv
Prototype
int(*sidiv) (int32_t numerator, int32_t denominator);