aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/types.h')
-rw-r--r--src/vppinfra/types.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/types.h b/src/vppinfra/types.h
index 24dd5b30e02..e098db5fbaf 100644
--- a/src/vppinfra/types.h
+++ b/src/vppinfra/types.h
@@ -135,6 +135,14 @@ pointer_to_uword (const void *p)
return (uword) (clib_address_t) p;
}
+static inline __attribute__ ((always_inline)) uword
+pointer_is_aligned (void *p, uword align)
+{
+ if ((pointer_to_uword (p) & (align - 1)) == 0)
+ return 1;
+ return 0;
+}
+
#define uword_to_pointer(u,type) ((type) (clib_address_t) (u))
/* Any type: can be either word or pointer. */