DIV_ROUND_UP
时间: 2023-09-07 12:11:18 浏览: 165
DIV_ROUND_UP是一个宏定义,在给定的代码片段中被定义为 (((n) + (d) - 1) / (d))。
这个宏的作用是将一个除法运算向上取整,即将两个数相加后再减去1,然后再除以除数。它的设计初衷是用于计算整数除法的商的上界。
另外,在引用的第三个宏定义中,BITS_TO_LONGS(nr)将一个给定的位数转换为所需的long型数目,它使用了DIV_ROUND_UP宏来计算商的上界。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [linux 内核常见的宏控](https://blog.csdn.net/weixin_42546931/article/details/124182347)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [内核宏之—DIV_ROUND_UP(向上取整)&&virt_to_page&&GRUB,UEFI](https://blog.csdn.net/weixin_45264425/article/details/129188805)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文