mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-18 17:48:28 +02:00
shared: add NM_DIV_ROUND_UP() helper macro
Inspired by ethtool's DIV_ROUND_UP() and systemd's DIV_ROUND_UP().
This commit is contained in:
parent
df30651b89
commit
b7c8e3dbfa
1 changed files with 8 additions and 0 deletions
|
|
@ -1137,6 +1137,14 @@ nm_clear_g_cancellable (GCancellable **cancellable)
|
|||
&& ((__x & (__x - (((typeof(__x)) 1)))) == ((typeof(__x)) 0))); \
|
||||
})
|
||||
|
||||
#define NM_DIV_ROUND_UP(x, y) \
|
||||
({ \
|
||||
const typeof(x) _x = (x); \
|
||||
const typeof(y) _y = (y); \
|
||||
\
|
||||
(_x / _y + !!(_x % _y)); \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_UTILS_LOOKUP_DEFAULT(v) return (v)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue