summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vec_bootstrap.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-17 15:46:25 +0100
committerDamjan Marion <dmarion@me.com>2022-03-18 13:16:24 +0000
commita4a28f04cb887ee690ccc9f563d06bf74fe18faf (patch)
tree13d960091319496e1625dae4db25091764ce30c7 /src/vppinfra/vec_bootstrap.h
parent86bbdf926c6d642e789ad6dce6534c23820f3c63 (diff)
vppinfra: use stored vec header size to find header
Type: refactor Change-Id: Iaa1e43c87c5725ab33ea8489bff2a7bda18b9c79 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vec_bootstrap.h')
-rw-r--r--src/vppinfra/vec_bootstrap.h28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/vppinfra/vec_bootstrap.h b/src/vppinfra/vec_bootstrap.h
index 34e50c9edb1..5dc1b6af540 100644
--- a/src/vppinfra/vec_bootstrap.h
+++ b/src/vppinfra/vec_bootstrap.h
@@ -89,7 +89,6 @@ always_inline uword
vec_get_header_size (void *v)
{
uword header_size = _vec_find (v)->hdr_size * VEC_HEADER_ROUND;
- ASSERT (header_size >= vec_header_bytes (0));
return header_size;
}
@@ -100,9 +99,9 @@ vec_get_header_size (void *v)
*/
always_inline void *
-vec_header (void *v, uword header_bytes)
+vec_header (void *v)
{
- return v - vec_header_bytes (header_bytes);
+ return v ? v - vec_get_header_size (v) : 0;
}
/** \brief Find the end of user vector header
@@ -112,30 +111,11 @@ vec_header (void *v, uword header_bytes)
*/
always_inline void *
-vec_header_end (void *v, uword header_bytes)
+vec_header_end (void *v)
{
- return v + vec_header_bytes (header_bytes);
+ return v + vec_get_header_size (v);
}
-always_inline uword
-vec_aligned_header_bytes (uword header_bytes, uword align)
-{
- return round_pow2 (header_bytes + sizeof (vec_header_t), align);
-}
-
-always_inline void *
-vec_aligned_header (void *v, uword header_bytes, uword align)
-{
- return v - vec_aligned_header_bytes (header_bytes, align);
-}
-
-always_inline void *
-vec_aligned_header_end (void *v, uword header_bytes, uword align)
-{
- return v + vec_aligned_header_bytes (header_bytes, align);
-}
-
-
/** \brief Number of elements in vector (lvalue-capable)
_vec_len (v) does not check for null, but can be used as an lvalue