mirror of
https://github.com/opnsense/src.git
synced 2026-03-11 02:31:16 -04:00
LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL.
This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week
This commit is contained in:
parent
b55d4ebe5f
commit
c4e0746e7d
1 changed files with 5 additions and 0 deletions
|
|
@ -130,9 +130,14 @@
|
|||
#define ALIGN(x, y) roundup2((x), (y))
|
||||
#undef PTR_ALIGN
|
||||
#define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a)))
|
||||
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
|
||||
/* Moved from linuxkpi_gplv2 */
|
||||
#define IS_ALIGNED(x, a) (((x) & ((__typeof(x))(a) - 1)) == 0)
|
||||
#endif
|
||||
#define DIV_ROUND_UP(x, n) howmany(x, n)
|
||||
#define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n)
|
||||
#define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n))
|
||||
#define DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n))
|
||||
#define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f)
|
||||
|
||||
#define printk(...) printf(__VA_ARGS__)
|
||||
|
|
|
|||
Loading…
Reference in a new issue