Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
api: ip_source_check_interface_add_del api is added.
[vpp.git]
/
src
/
vppinfra
/
string.h
diff --git
a/src/vppinfra/string.h
b/src/vppinfra/string.h
index
5c1d826
..
b00c0cf
100644
(file)
--- a/
src/vppinfra/string.h
+++ b/
src/vppinfra/string.h
@@
-78,10
+78,10
@@
void clib_memswap (void *_a, void *_b, uword bytes);
#elif __SSSE3__
#include <vppinfra/memcpy_sse3.h>
#else
#elif __SSSE3__
#include <vppinfra/memcpy_sse3.h>
#else
-#define
_clib_memcpy
(a,b,c) memcpy(a,b,c)
+#define
clib_memcpy_fast
(a,b,c) memcpy(a,b,c)
#endif
#else /* __COVERITY__ */
#endif
#else /* __COVERITY__ */
-#define
_clib_memcpy
(a,b,c) memcpy(a,b,c)
+#define
clib_memcpy_fast
(a,b,c) memcpy(a,b,c)
#endif
/* c-11 string manipulation variants */
#endif
/* c-11 string manipulation variants */
@@
-107,6
+107,16
@@
memcpy_s_inline (void *__restrict__ dest, rsize_t dmax,
uword low, hi;
u8 bad;
uword low, hi;
u8 bad;
+ /*
+ * Optimize constant-number-of-bytes calls without asking
+ * "too many questions for someone from New Jersey"
+ */
+ if (__builtin_constant_p (n))
+ {
+ clib_memcpy_fast (dest, src, n);
+ return EOK;
+ }
+
/*
* call bogus if: src or dst NULL, trying to copy
* more data than we have space in dst, or src == dst.
/*
* call bogus if: src or dst NULL, trying to copy
* more data than we have space in dst, or src == dst.
@@
-140,7
+150,7
@@
memcpy_s_inline (void *__restrict__ dest, rsize_t dmax,
return EINVAL;
}
return EINVAL;
}
-
_clib_memcpy
(dest, src, n);
+
clib_memcpy_fast
(dest, src, n);
return EOK;
}
return EOK;
}
@@
-247,10
+257,10
@@
clib_memcpy64_x4 (void *d0, void *d1, void *d2, void *d3, void *s)
_mm_storeu_si128 ((__m128i *) (d3 + 3 * 16), r3);
#else
_mm_storeu_si128 ((__m128i *) (d3 + 3 * 16), r3);
#else
- clib_memcpy (d0, s, 64);
- clib_memcpy (d1, s, 64);
- clib_memcpy (d2, s, 64);
- clib_memcpy (d3, s, 64);
+ clib_memcpy
_fast
(d0, s, 64);
+ clib_memcpy
_fast
(d1, s, 64);
+ clib_memcpy
_fast
(d2, s, 64);
+ clib_memcpy
_fast
(d3, s, 64);
#endif
}
#endif
}