• Willy Tarreau's avatar
    tools/nolibc/string: use unidirectional variants for memcpy() · d8dcc2d8
    Willy Tarreau authored
    
    
    Till now memcpy() relies on memmove(), but it's always included for libgcc,
    so we have a larger than needed function. Let's implement two unidirectional
    variants to copy from bottom to top and from top to bottom, and use the
    former for memcpy(). The variants are optimized to be compact, and at the
    same time the compiler is sometimes able to detect the loop and to replace
    it with a "rep movsb". The new function is 24 bytes instead of 52 on x86_64.
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    d8dcc2d8
string.h 2.31 KB