summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vec.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-05-04 20:45:41 +0200
committerFlorin Coras <florin.coras@gmail.com>2018-05-05 01:20:53 +0000
commit2f25ef33c870869e613b81ee7603b9b7337e48fe (patch)
treee0c0cfd6bd76bfc4f321a38e2bdbf8914ee452f3 /src/vppinfra/vec.h
parent89c27818b3bba409ed8e4ccacc9be37384b46705 (diff)
autodetect alignment during _vec_resize
Change-Id: I2896dbde78b5d58dc706756f4c76632c303557ae Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vec.h')
-rw-r--r--src/vppinfra/vec.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index a029630559c..f233ae1c48f 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -111,10 +111,13 @@ void *vec_resize_allocate_memory (void *v,
@return v_prime pointer to resized vector, may or may not equal v
*/
+#define _vec_resize(V,L,DB,HB,A) \
+ _vec_resize_inline(V,L,DB,HB,clib_max((__alignof__((V)[0])),(A)))
+
always_inline void *
-_vec_resize (void *v,
- word length_increment,
- uword data_bytes, uword header_bytes, uword data_align)
+_vec_resize_inline (void *v,
+ word length_increment,
+ uword data_bytes, uword header_bytes, uword data_align)
{
vec_header_t *vh = _vec_find (v);
uword new_data_bytes, aligned_header_bytes;