aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector/index_to_ptr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/vector/index_to_ptr.h')
-rw-r--r--src/vppinfra/vector/index_to_ptr.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vppinfra/vector/index_to_ptr.h b/src/vppinfra/vector/index_to_ptr.h
index 91de3546439..3985b757d54 100644
--- a/src/vppinfra/vector/index_to_ptr.h
+++ b/src/vppinfra/vector/index_to_ptr.h
@@ -92,7 +92,7 @@ clib_index_to_ptr_u32 (u32 *indices, void *base, u8 shift, void **ptrs,
indices += 16;
n_elts -= 16;
}
- if (n_elts > 8)
+ if (n_elts >= 8)
{
b0 = u64x8_from_u32x8 (u32x8_load_unaligned (indices));
u64x8_store_unaligned ((b0 << shift) + off, ptrs);
@@ -101,6 +101,9 @@ clib_index_to_ptr_u32 (u32 *indices, void *base, u8 shift, void **ptrs,
n_elts -= 8;
}
+ if (n_elts == 0)
+ return;
+
b0 = u64x8_from_u32x8 (u32x8_load_unaligned (indices + n_elts - 8));
u64x8_store_unaligned ((b0 << shift) + off, ptrs + n_elts - 8);
}