Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | #ifndef STDLIB_H |
| 2 | #define STDLIB_H |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | |
Uwe Hermann | 55e6eba | 2007-10-27 20:05:21 +0000 | [diff] [blame] | 6 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 7 | |
Rudolf Marek | 79e5325 | 2008-12-23 17:34:15 +0000 | [diff] [blame] | 8 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) |
| 9 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
| 10 | |
Rudolf Marek | c221349 | 2008-03-19 20:24:33 +0000 | [diff] [blame] | 11 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
| 12 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
| 13 | |
Stefan Reinauer | 35b6bbb | 2010-03-28 21:26:54 +0000 | [diff] [blame] | 14 | #if !defined(__PRE_RAM__) |
Stefan Reinauer | 6bd571e | 2009-09-25 21:59:57 +0000 | [diff] [blame] | 15 | void *malloc(size_t size); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 16 | void free(void *ptr); |
Corey Osgood | 908ff5e | 2007-11-07 19:02:35 +0000 | [diff] [blame] | 17 | #endif |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 18 | |
| 19 | #endif /* STDLIB_H */ |