diff --git a/include/nuttx/nuttx.h b/include/nuttx/nuttx.h index 1c67a705e87..adeaf94fce3 100644 --- a/include/nuttx/nuttx.h +++ b/include/nuttx/nuttx.h @@ -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: