Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / linux / align.h
blob2b4acec7b95a27b6768d48f46519abc584c94d5d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_ALIGN_H
3 #define _LINUX_ALIGN_H
5 #include <linux/const.h>
7 /* @a is a power of 2 value */
8 #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
9 #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
10 #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
11 #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
12 #define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
13 #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
15 #endif /* _LINUX_ALIGN_H */