29,18 → 29,19 |
#ifndef __ALIGN_H__ |
#define __ALIGN_H__ |
|
/** Align to the nearest higher address. |
/** Align to the nearest lower address. |
* |
* @param s Address or size to be aligned. |
* @param a Size of alignment. |
* @param a Size of alignment, must be power of 2. |
*/ |
#define ALIGN_UP(s, a) ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s)) |
#define ALIGN_DOWN(s, a) ((s) & ~((a) - 1)) |
|
/** Align to the nearest lower address. |
|
/** Align to the nearest higher address. |
* |
* @param s Address or size to be aligned. |
* @param a Size of alignment. |
* @param a Size of alignment, must be power of 2. |
*/ |
#define ALIGN_DOWN(s, a) ((s) & ~((a)-1)) |
#define ALIGN_UP(s, a) ((s + ((a) - 1)) & ~((a) - 1)) |
|
#endif |