Subversion Repositories HelenOS-historic

Rev

Rev 534 | Rev 565 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 534 Rev 564
Line 27... Line 27...
27
 */
27
 */
28
 
28
 
29
#ifndef __ALIGN_H__
29
#ifndef __ALIGN_H__
30
#define __ALIGN_H__
30
#define __ALIGN_H__
31
 
31
 
-
 
32
/** Align to the nearest higher address.
-
 
33
 *
-
 
34
 * @param s Address or size to be aligned.
-
 
35
 * @param a Size of alignment.
-
 
36
 */
32
#define ALIGN(s, a) ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s))
37
#define ALIGN_UP(s, a)      ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s))
-
 
38
 
-
 
39
/** Align to the nearest lower address.
-
 
40
 *
-
 
41
 * @param s Address or size to be aligned.
-
 
42
 * @param a Size of alignment.
-
 
43
 */
-
 
44
#define ALIGN_DOWN(s, a)    ((s) & ~((a)-1))
33
 
45
 
34
#endif
46
#endif