coreboot: introduce commonlib
Instead of reaching into src/include and re-writing code allow for cleaner code sharing within coreboot and its utilities. The additional thing needed at this point is for the utilities to provide a printk() declaration within a <console/console.h> file. That way code which uses printk() can than be mapped properly to verbosity of utility parameters. Change-Id: I9e46a279569733336bc0a018aed96bc924c07cdd Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/11592 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
@ -3,20 +3,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#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))
|
||||
#define ALIGN_UP(x,a) ALIGN((x),(a))
|
||||
#define ALIGN_DOWN(x,a) ((x) & ~((typeof(x))(a)-1UL))
|
||||
#define IS_ALIGNED(x,a) (((x) & ((typeof(x))(a)-1UL)) == 0)
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
|
||||
#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b))
|
||||
#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
|
||||
|
||||
#define min(a,b) MIN((a),(b))
|
||||
#define max(a,b) MAX((a),(b))
|
||||
|
||||
|
Reference in New Issue
Block a user