mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 07:00:09 +01:00
helpers: Add an integer division helper that rounds up
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
617bb9afc9
commit
b3d94c9843
1 changed files with 10 additions and 0 deletions
|
|
@ -95,6 +95,16 @@ do { \
|
||||||
#define CLIP(c, x, y) MIN(MAX(c, x), y)
|
#define CLIP(c, x, y) MIN(MAX(c, x), y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divides two integers, rounding up.
|
||||||
|
*
|
||||||
|
* @param n the numerator to divide.
|
||||||
|
* @param d the denominator to divide by.
|
||||||
|
* @return the rounded up result of the division n / d.
|
||||||
|
*/
|
||||||
|
#define DIV_ROUND_UP(n, d) \
|
||||||
|
({ typeof(d) tmp = (d); ((n) + tmp - 1) / tmp; })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to the containing struct of a given member item.
|
* Returns a pointer to the containing struct of a given member item.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue