blob: c3052bd209007e62fb47e1aa29125fc8494f8fa6 [file] [log] [blame]
Eric Biederman8ca8d762003-04-22 19:02:15 +00001#ifndef STDLIB_H
2#define STDLIB_H
3
4#include <stddef.h>
5
Uwe Hermann55e6eba2007-10-27 20:05:21 +00006#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
7
Rudolf Marek79e53252008-12-23 17:34:15 +00008#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
9#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
10
Rudolf Marekc2213492008-03-19 20:24:33 +000011#define MIN(a,b) ((a) < (b) ? (a) : (b))
12#define MAX(a,b) ((a) > (b) ? (a) : (b))
13
Corey Osgood908ff5e2007-11-07 19:02:35 +000014#ifndef __ROMCC__
Eric Biederman8ca8d762003-04-22 19:02:15 +000015extern void *malloc(size_t size);
Eric Biederman8ca8d762003-04-22 19:02:15 +000016void free(void *ptr);
17
18/* Extensions to malloc... */
19typedef size_t malloc_mark_t;
20void malloc_mark(malloc_mark_t *place);
21void malloc_release(malloc_mark_t *place);
Corey Osgood908ff5e2007-11-07 19:02:35 +000022#endif
Eric Biederman8ca8d762003-04-22 19:02:15 +000023
24#endif /* STDLIB_H */