summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/flash.h b/flash.h
index 5bbfa0aa5..b60a98097 100644
--- a/flash.h
+++ b/flash.h
@@ -37,6 +37,12 @@
#include "libflashrom.h"
#include "layout.h"
+#define KiB (1024)
+#define MiB (1024 * KiB)
+
+/* Assumes `n` and `a` are at most 64-bit wide (to avoid typeof() operator). */
+#define ALIGN_DOWN(n, a) ((n) & ~((uint64_t)(a) - 1))
+
#define ERROR_PTR ((void*)-1)
/* Error codes */