summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
9811007)
Type: fix
Change-Id: Id5ca868cd7a2abc9320206f0336aa3348f5906e3
Signed-off-by: Benoît Ganne <bganne@cisco.com>
- if (max_count == 1)
- return 1;
+ if (max_count <= 1)
+ return max_count;
if (data[0] != data[1])
return 1;
if (data[0] != data[1])
return 1;
#if defined(CLIB_HAVE_VEC256)
u64x4 splat = u64x4_splat (first);
#if defined(CLIB_HAVE_VEC256)
u64x4 splat = u64x4_splat (first);
+ while (count + 3 < max_count)
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u64x4_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 8;
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u64x4_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 8;
- return clib_min (count, max_count);
-
- if (count >= max_count)
- return max_count;
count += 2;
data += 2;
while (count + 3 < max_count &&
count += 2;
data += 2;
while (count + 3 < max_count &&
while (count < max_count && (data[0] == first))
{
data += 1;
while (count < max_count && (data[0] == first))
{
data += 1;
- if (max_count == 1)
- return 1;
+ if (max_count <= 1)
+ return max_count;
if (data[0] != data[1])
return 1;
if (data[0] != data[1])
return 1;
#if defined(CLIB_HAVE_VEC256)
u32x8 splat = u32x8_splat (first);
#if defined(CLIB_HAVE_VEC256)
u32x8 splat = u32x8_splat (first);
+ while (count + 7 < max_count)
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u32x8_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 4;
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u32x8_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 4;
- return clib_min (count, max_count);
-
- if (count >= max_count)
- return max_count;
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u32x4 splat = u32x4_splat (first);
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u32x4 splat = u32x4_splat (first);
+ while (count + 3 < max_count)
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u32x4_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp) / 4;
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u32x4_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp) / 4;
- return clib_min (count, max_count);
-
- if (count >= max_count)
- return max_count;
count += 2;
data += 2;
while (count + 3 < max_count &&
count += 2;
data += 2;
while (count + 3 < max_count &&
while (count < max_count && (data[0] == first))
{
data += 1;
while (count < max_count && (data[0] == first))
{
data += 1;
- if (max_count == 1)
- return 1;
+ if (max_count <= 1)
+ return max_count;
if (data[0] != data[1])
return 1;
if (data[0] != data[1])
return 1;
#if defined(CLIB_HAVE_VEC256)
u16x16 splat = u16x16_splat (first);
#if defined(CLIB_HAVE_VEC256)
u16x16 splat = u16x16_splat (first);
+ while (count + 15 < max_count)
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u16x16_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 2;
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u16x16_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp) / 2;
- return clib_min (count, max_count);
}
data += 16;
count += 16;
}
data += 16;
count += 16;
-
- if (count >= max_count)
- return max_count;
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u16x8 splat = u16x8_splat (first);
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u16x8 splat = u16x8_splat (first);
+ while (count + 7 < max_count)
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u16x8_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp) / 2;
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u16x8_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp) / 2;
- return clib_min (count, max_count);
-
- if (count >= max_count)
- return max_count;
count += 2;
data += 2;
while (count + 3 < max_count &&
count += 2;
data += 2;
while (count + 3 < max_count &&
while (count < max_count && (data[0] == first))
{
data += 1;
while (count < max_count && (data[0] == first))
{
data += 1;
- if (max_count == 1)
- return 1;
+ if (max_count <= 1)
+ return max_count;
if (data[0] != data[1])
return 1;
if (data[0] != data[1])
return 1;
#if defined(CLIB_HAVE_VEC256)
u8x32 splat = u8x32_splat (first);
#if defined(CLIB_HAVE_VEC256)
u8x32 splat = u8x32_splat (first);
+ while (count + 31 < max_count)
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u8x32_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp);
{
u64 bmp;
bmp = u8x32_msb_mask ((u8x32) (u8x32_load_unaligned (data) == splat));
if (bmp != 0xffffffff)
{
count += count_trailing_zeros (~bmp);
- return clib_min (count, max_count);
}
data += 32;
count += 32;
}
data += 32;
count += 32;
-
- if (count >= max_count)
- return max_count;
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u8x16 splat = u8x16_splat (first);
}
#elif defined(CLIB_HAVE_VEC128) && defined(CLIB_HAVE_VEC128_MSB_MASK)
u8x16 splat = u8x16_splat (first);
+ while (count + 15 < max_count)
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u8x16_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp);
{
u64 bmp;
bmp = u8x16_msb_mask ((u8x16) (u8x16_load_unaligned (data) == splat));
if (bmp != 0xffff)
{
count += count_trailing_zeros (~bmp);
- return clib_min (count, max_count);
}
data += 16;
count += 16;
}
data += 16;
count += 16;
-
- if (count >= max_count)
- return max_count;
count += 2;
data += 2;
while (count + 3 < max_count &&
count += 2;
data += 2;
while (count + 3 < max_count &&
while (count < max_count && (data[0] == first))
{
data += 1;
while (count < max_count && (data[0] == first))
{
data += 1;