summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/clib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r--src/vppinfra/clib.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index 6961d100a75..be21cad604b 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -254,6 +254,12 @@ is_pow2 (uword x)
}
always_inline uword
+round_down_pow2 (uword x, uword pow2)
+{
+ return (x) & ~(pow2 - 1);
+}
+
+always_inline uword
round_pow2 (uword x, uword pow2)
{
return (x + pow2 - 1) & ~(pow2 - 1);