diff options
Diffstat (limited to 'src/commonlib/bsd')
-rw-r--r-- | src/commonlib/bsd/include/commonlib/bsd/helpers.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/helpers.h b/src/commonlib/bsd/include/commonlib/bsd/helpers.h index 376ebaef11..733b05a8f1 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/helpers.h +++ b/src/commonlib/bsd/include/commonlib/bsd/helpers.h @@ -54,6 +54,9 @@ #define POWER_OF_2(x) (1ULL << (x)) +/* Set bits from `high` to `low` (inclusive). */ +#define GENMASK(high, low) (((~0ULL) << (low)) & (~0ULL >> (63 - (high)))) + #define DIV_ROUND_UP(x, y) ({ \ __typeof__(x) _div_local_x = (x); \ __typeof__(y) _div_local_y = (y); \ |