1*823f0493SLoGin /* SPDX-License-Identifier: GPL-2.0 */ 2*823f0493SLoGin #ifndef _LINUX_ALIGN_H 3*823f0493SLoGin #define _LINUX_ALIGN_H 4*823f0493SLoGin 5*823f0493SLoGin #include "const.h" 6*823f0493SLoGin 7*823f0493SLoGin /* @a is a power of 2 value */ 8*823f0493SLoGin #define ALIGN_UP(x, a) __ALIGN_KERNEL((x), (a)) 9*823f0493SLoGin #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) 10*823f0493SLoGin #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) 11*823f0493SLoGin #define PTR_ALIGN(p, a) ((typeof(p))ALIGN_UP((unsigned long)(p), (a))) 12*823f0493SLoGin #define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a))) 13*823f0493SLoGin #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 14*823f0493SLoGin 15*823f0493SLoGin #endif /* _LINUX_ALIGN_H */ 16