From f79f8b4e33a4da257dfacce0eab582b4638791fc Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Fri, 27 Mar 2020 10:46:35 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/39881 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/commonlib/bsd/include/commonlib/bsd/helpers.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/commonlib') 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); \ -- cgit v1.2.3