summaryrefslogtreecommitdiffstats
path: root/src/commonlib/bsd/include/commonlib/bsd/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib/bsd/include/commonlib/bsd/helpers.h')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/helpers.h3
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 376ebaef11cf..733b05a8f1c0 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); \