summaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-03-27 10:46:35 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-03-30 08:44:33 +0000
commitf79f8b4e33a4da257dfacce0eab582b4638791fc (patch)
treea924a03b96a22eaf621ffa30419fc71a71a45bce /src/commonlib
parent654d9d6b36765408d507a22d49e142b331492891 (diff)
downloadcoreboot-f79f8b4e33a4da257dfacce0eab582b4638791fc.tar.xz
helpers: Add a helper macro for calculating power of 2
This change adds a helper macro POWER_OF_2 that is useful for calculating the requested power of 2. Change-Id: Ie70f93b6ac175699c11cae7d8f023a52cce01e88 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39881 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/helpers.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/helpers.h b/src/commonlib/bsd/include/commonlib/bsd/helpers.h
index a305df0cd5..4e6ebeefdd 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/helpers.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/helpers.h
@@ -52,6 +52,8 @@
(_power_local_x & (_power_local_x - 1)) == 0; \
})
+#define POWER_OF_2(x) (1ULL << (x))
+
#define DIV_ROUND_UP(x, y) ({ \
__typeof__(x) _div_local_x = (x); \
__typeof__(y) _div_local_y = (y); \