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
488 of 515
NXP Semiconductors
UM11029
Chapter 30: LPC84x ROM API integer divide routines
30.5 Functional description
30.5.1 Signed division
The example C-code listing below shows how to perform a signed integer division via the
ROM API.
/* Divide (-99) by (+6) */
int32_t result;
result = pROMDiv->sidiv(-99, 6);
/* result now contains (-16) */
30.5.2 Unsigned division with remainder
The example C-code listing below shows how to perform an unsigned integer division with
remainder via the ROM API.
/* Modulus Divide (+99) by (+4) */
uidiv_return result;
result = pROMDiv-> uidivmod (+99, 4);
/* result.div contains (+24) */
/* result.mod contains (+3) */