X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvppinfra%2Fstring.h;h=db09c5084470e39aca669cbef721667c32845507;hb=b5a2b05327c1a2bbb23dbb7131cc1be6c0db5e67;hp=fb46a0c6a0d570a1d25ab569c68f90ccf4ddc8e8;hpb=1a3e08a7197addb1c07e66c1b1da3286c9bcb140;p=vpp.git diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h index fb46a0c6a0d..db09c508447 100644 --- a/src/vppinfra/string.h +++ b/src/vppinfra/string.h @@ -99,6 +99,8 @@ clib_memcpy_fast (void *restrict dst, const void *restrict src, size_t n) #undef clib_memcpy_fast_arch +#include + /* c-11 string manipulation variants */ #ifndef EOK @@ -143,7 +145,7 @@ memcpy_s_inline (void *__restrict__ dest, rsize_t dmax, * Optimize constant-number-of-bytes calls without asking * "too many questions for someone from New Jersey" */ - if (__builtin_constant_p (n)) + if (COMPILE_TIME_CONST (n)) { clib_memcpy_fast (dest, src, n); return EOK; @@ -676,10 +678,7 @@ clib_count_equal_u8 (u8 * data, uword max_count) u64 bmp; bmp = u8x32_msb_mask ((u8x32) (u8x32_load_unaligned (data) == splat)); if (bmp != 0xffffffff) - { - count += count_trailing_zeros (~bmp); - return max_count; - } + return max_count; data += 32; count += 32; @@ -1396,7 +1395,7 @@ strstr_s_inline (char *s1, rsize_t s1max, const char *s2, rsize_t s2max, clib_c11_violation ("substring NULL"); if (s1 && s1max && (s1[clib_strnlen (s1, s1max)] != '\0')) clib_c11_violation ("s1 unterminated"); - if (s2 && s2max && (s2[clib_strnlen (s2, s1max)] != '\0')) + if (s2 && s2max && (s2[clib_strnlen (s2, s2max)] != '\0')) clib_c11_violation ("s2 unterminated"); return EINVAL; }