Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39881 )
Change subject: helpers: Add a helper macro for calculating power of 2 ......................................................................
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 --- M src/commonlib/bsd/include/commonlib/bsd/helpers.h 1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/39881/1
diff --git a/src/commonlib/bsd/include/commonlib/bsd/helpers.h b/src/commonlib/bsd/include/commonlib/bsd/helpers.h index a305df0..4e6ebee 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); \
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39881 )
Change subject: helpers: Add a helper macro for calculating power of 2 ......................................................................
Patch Set 2: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/39881 )
Change subject: helpers: Add a helper macro for calculating power of 2 ......................................................................
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 --- M src/commonlib/bsd/include/commonlib/bsd/helpers.h 1 file changed, 2 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved
diff --git a/src/commonlib/bsd/include/commonlib/bsd/helpers.h b/src/commonlib/bsd/include/commonlib/bsd/helpers.h index a305df0..4e6ebee 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); \