No assembly language is required as glibc version >= 2.32. This is because the later glibc version has updated this optimization.
Signed-off-by: Kai Ye yekai13@huawei.com --- src/uadk_utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/uadk_utils.c b/src/uadk_utils.c index 2b34b3a..ec12e67 100644 --- a/src/uadk_utils.c +++ b/src/uadk_utils.c @@ -14,9 +14,12 @@ * limitations under the License. * */ +#include <gnu/libc-version.h> #include "uadk_utils.h"
-#define UADK_MEM_IMPROVE_THRESHOLD 1024 +#define GLIBC_MAIN 2U +#define GLIBC_MINOR 32U +#define UADK_MEM_IMPROVE_THRESHOLD 1024U
static void *memcpy_large(void *dstpp, const void *srcpp, size_t len) { @@ -56,7 +59,9 @@ static void *memcpy_large(void *dstpp, const void *srcpp, size_t len)
void *uadk_memcpy(void *dstpp, const void *srcpp, size_t len) { - if (len >= UADK_MEM_IMPROVE_THRESHOLD) + /* No assembly language is required as glibc version >= 2.32 */ + if (((__GLIBC__ == GLIBC_MAIN && __GLIBC_MINOR__ < GLIBC_MINOR) || + __GLIBC__ < GLIBC_MAIN) && len >= UADK_MEM_IMPROVE_THRESHOLD) return memcpy_large(dstpp, srcpp, len); else return memcpy(dstpp, srcpp, len);