From 776a4f281e077b81931e95bc29f6e2068f175ec1 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 8 Nov 2023 12:26:27 +0100 Subject: [PATCH] debugcc: add convenient macro GENMASK to calculate mask from bits Add convenient macro GENMASK to calculate masks from bits similar to how it's implemented in kernel linux tools. This is useful to better describe some specific define instead of using comments and raw HEX values. Signed-off-by: Christian Marangi --- debugcc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/debugcc.h b/debugcc.h index df9981a..b165865 100644 --- a/debugcc.h +++ b/debugcc.h @@ -32,6 +32,7 @@ #define __DEBUGCC_H__ #define BIT(x) (1 << (x)) +#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h)))) #define CORE_CC_BLOCK "core"