Use the DIV_ROUND_UP macro to replace open-coded divisor calculation
(((n) + (d) - 1) / (d)) to improve readability.
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
void __init init_frametable(void)
{
unsigned int sidx, eidx, nidx;
- unsigned int max_idx = (max_pdx + PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT;
+ unsigned int max_idx = DIV_ROUND_UP(max_pdx, PDX_GROUP_COUNT);
struct page_info *end_pg, *top_pg;
BUILD_BUG_ON(XEN_VIRT_END > FRAMETABLE_VIRT_START);
vmac_t *mac)
{
unsigned int sidx, eidx, nidx;
- unsigned int max_idx = (max_pdx + PDX_GROUP_COUNT - 1)/PDX_GROUP_COUNT;
+ unsigned int max_idx = DIV_ROUND_UP(max_pdx, PDX_GROUP_COUNT);
uint8_t nonce[16] = {};
vmac_ctx_t ctx;
spfn = _mfn(info->spfn);
epfn = _mfn(info->epfn);
- eidx = (mfn_to_pdx(epfn) + PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT;
+ eidx = DIV_ROUND_UP(mfn_to_pdx(epfn), PDX_GROUP_COUNT);
nidx = cidx = mfn_to_pdx(spfn)/PDX_GROUP_COUNT;
ASSERT( mfn_to_pdx(epfn) <= (DIRECTMAP_SIZE >> PAGE_SHIFT) &&