xref: /linux-6.15/include/vdso/align.h (revision 5b47aba8)
1*5b47aba8SThomas Weißschuh /* SPDX-License-Identifier: GPL-2.0 */
2*5b47aba8SThomas Weißschuh #ifndef __VDSO_ALIGN_H
3*5b47aba8SThomas Weißschuh #define __VDSO_ALIGN_H
4*5b47aba8SThomas Weißschuh 
5*5b47aba8SThomas Weißschuh #include <vdso/const.h>
6*5b47aba8SThomas Weißschuh 
7*5b47aba8SThomas Weißschuh /* @a is a power of 2 value */
8*5b47aba8SThomas Weißschuh #define ALIGN(x, a)		__ALIGN_KERNEL((x), (a))
9*5b47aba8SThomas Weißschuh #define ALIGN_DOWN(x, a)	__ALIGN_KERNEL((x) - ((a) - 1), (a))
10*5b47aba8SThomas Weißschuh #define __ALIGN_MASK(x, mask)	__ALIGN_KERNEL_MASK((x), (mask))
11*5b47aba8SThomas Weißschuh #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
12*5b47aba8SThomas Weißschuh #define PTR_ALIGN_DOWN(p, a)	((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
13*5b47aba8SThomas Weißschuh #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
14*5b47aba8SThomas Weißschuh 
15*5b47aba8SThomas Weißschuh #endif	/* __VDSO_ALIGN_H */
16