Align: Make sure 1 is treated as unsigned long instead of int
[coreboot.git] / src / include / stdlib.h
index eb67d20fe7c6009230c798921ec289c15e859513..5465c14f925be86ecd16fbcb0499d704b3674749 100644 (file)
@@ -3,12 +3,17 @@
 
 #include <stddef.h>
 
-extern void *malloc(size_t size);
-void free(void *ptr);
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+#define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1UL)
+#define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
 
-/* Extensions to malloc... */
-typedef size_t malloc_mark_t;
-void malloc_mark(malloc_mark_t *place);
-void malloc_release(malloc_mark_t *place);
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+#if !defined(__PRE_RAM__)
+void *malloc(size_t size);
+void free(void *ptr);
+#endif
 
 #endif /* STDLIB_H */