Skip to content

Commit 776a4f2

Browse files
committed
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 <[email protected]>
1 parent 93f5ccd commit 776a4f2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

debugcc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define __DEBUGCC_H__
3333

3434
#define BIT(x) (1 << (x))
35+
#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))
3536

3637
#define CORE_CC_BLOCK "core"
3738

0 commit comments

Comments
 (0)