RTEMS  5.1
Files | Macros

Generic. More...

Files

file  align.h
 
file  gentypes.h
 
file  align.h
 Macros for making values and addresses aligned.
 

Macros

#define ALIGN_UP(addr, align)   (((addr) + ((align) - 1)) & ~((align) - 1))
 
#define ALIGN_DOWN(s, a)   ((s) & ~((a) - 1))
 
#define ALIGN_UP(s, a)   (((s) + ((a) - 1)) & ~((a) - 1))
 

Detailed Description

Generic.

Macro Definition Documentation

◆ ALIGN_DOWN

#define ALIGN_DOWN (   s,
 
)    ((s) & ~((a) - 1))

Align to the nearest lower address.

Parameters
sAddress or size to be aligned.
aSize of alignment, must be power of 2.

◆ ALIGN_UP [1/2]

#define ALIGN_UP (   addr,
  align 
)    (((addr) + ((align) - 1)) & ~((align) - 1))

Align to the nearest higher address.

Parameters
addrAddress or size to be aligned.
alignSize of alignment, must be power of 2.

◆ ALIGN_UP [2/2]

#define ALIGN_UP (   s,
 
)    (((s) + ((a) - 1)) & ~((a) - 1))

Align to the nearest higher address.

Parameters
sAddress or size to be aligned.
aSize of alignment, must be power of 2.