include/nuttx.h: add common align definitions for nuttx
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
430820e7ec
commit
b7d5a30f85
@ -33,6 +33,28 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Align definitions */
|
||||
|
||||
#ifndef ALIGN_MASK
|
||||
# define ALIGN_MASK(s) ((1 << (s)) - 1)
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN_UP
|
||||
# define ALIGN_UP(x,a) (((x) + ((a) - 1)) & ~((a) - 1))
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN_UP_MASK
|
||||
# define ALIGN_UP_MASK(x,m) (((x) + (m)) & ~(m))
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN_DOWN
|
||||
# define ALIGN_DOWN(x,a) ((x) & (~((a) - 1)))
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN_DOWN_MASK
|
||||
# define ALIGN_DOWN_MASK(x,m) ((x) & ~(m))
|
||||
#endif
|
||||
|
||||
/* Name: container_of
|
||||
*
|
||||
* Description:
|
||||
|
Loading…
Reference in New Issue
Block a user