mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
include/nuttx.h: add common align definitions for nuttx
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
430820e7ec
commit
b7d5a30f85
@@ -33,6 +33,28 @@
|
|||||||
* Pre-processor Definitions
|
* 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
|
/* Name: container_of
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
|
|||||||
Reference in New Issue
Block a user