Subversion Repositories Kolibri OS

Rev

Rev 3031 | Rev 3243 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3031 Rev 3039
Line 34... Line 34...
34
#define ALIGN(x,a)      __ALIGN_MASK(x,(typeof(x))(a)-1)
34
#define ALIGN(x,a)      __ALIGN_MASK(x,(typeof(x))(a)-1)
35
#define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
35
#define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
36
#define PTR_ALIGN(p, a)     ((typeof(p))ALIGN((unsigned long)(p), (a)))
36
#define PTR_ALIGN(p, a)     ((typeof(p))ALIGN((unsigned long)(p), (a)))
37
#define IS_ALIGNED(x, a)        (((x) & ((typeof(x))(a) - 1)) == 0)
37
#define IS_ALIGNED(x, a)        (((x) & ((typeof(x))(a) - 1)) == 0)
Line -... Line 38...
-
 
38
 
38
 
39
/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
-
 
40
#define roundup(x, y) (                                 \
-
 
41
{                                                       \
-
 
42
        const typeof(y) __y = y;                        \
-
 
43
        (((x) + (__y - 1)) / __y) * __y;                \
-
 
44
}                                                       \
Line 39... Line 45...
39
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
45
)
40
 
46
 
41
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
47
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
42
#define DIV_ROUND_CLOSEST(x, divisor)(                  \
48
#define DIV_ROUND_CLOSEST(x, divisor)(                  \