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