X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fstring.h;h=8f165dfa18e28c19b8cd3680294c6388b73efb8a;hb=refs%2Fchanges%2F25%2F15125%2F2;hp=5a47725f5c3ef7b51c585e83041e02750133864a;hpb=29d22c52061df519c22b1bb58afe461d107899e2;p=vpp.git diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h index 5a47725f5c3..8f165dfa18e 100644 --- a/src/vppinfra/string.h +++ b/src/vppinfra/string.h @@ -324,12 +324,17 @@ clib_memset_u8 (void *p, u8 val, uword count) static_always_inline uword clib_count_equal_u64 (u64 * data, uword max_count) { - uword count = 0; - u64 first = data[0]; + uword count; + u64 first; + if (max_count == 1) + return 1; if (data[0] != data[1]) return 1; + count = 0; + first = data[0]; + #if defined(CLIB_HAVE_VEC256) u64x4 splat = u64x4_splat (first); while (1) @@ -369,12 +374,17 @@ clib_count_equal_u64 (u64 * data, uword max_count) static_always_inline uword clib_count_equal_u32 (u32 * data, uword max_count) { - uword count = 0; - u32 first = data[0]; + uword count; + u32 first; + if (max_count == 1) + return 1; if (data[0] != data[1]) return 1; + count = 0; + first = data[0]; + #if defined(CLIB_HAVE_VEC256) u32x8 splat = u32x8_splat (first); while (1) @@ -432,12 +442,17 @@ clib_count_equal_u32 (u32 * data, uword max_count) static_always_inline uword clib_count_equal_u16 (u16 * data, uword max_count) { - uword count = 0; - u16 first = data[0]; + uword count; + u16 first; + if (max_count == 1) + return 1; if (data[0] != data[1]) return 1; + count = 0; + first = data[0]; + #if defined(CLIB_HAVE_VEC256) u16x16 splat = u16x16_splat (first); while (1) @@ -495,12 +510,17 @@ clib_count_equal_u16 (u16 * data, uword max_count) static_always_inline uword clib_count_equal_u8 (u8 * data, uword max_count) { - uword count = 0; - u8 first = data[0]; + uword count; + u8 first; + if (max_count == 1) + return 1; if (data[0] != data[1]) return 1; + count = 0; + first = data[0]; + #if defined(CLIB_HAVE_VEC256) u8x32 splat = u8x32_splat (first); while (1)