Align: Make sure 1 is treated as unsigned long instead of int
[coreboot.git] / src / include / stdlib.h
1 #ifndef STDLIB_H
2 #define STDLIB_H
3
4 #include <stddef.h>
5
6 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
7
8 #define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1UL)
9 #define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
10
11 #define MIN(a,b) ((a) < (b) ? (a) : (b))
12 #define MAX(a,b) ((a) > (b) ? (a) : (b))
13
14 #if !defined(__PRE_RAM__)
15 void *malloc(size_t size);
16 void free(void *ptr);
17 #endif
18
19 #endif /* STDLIB_H */