tools/nolibc/string: slightly simplify memmove()
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Feb 2022 16:23:41 +0000 (17:23 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 24 Feb 2022 17:56:46 +0000 (09:56 -0800)
commita79fa17941bb23247d2d739485e6567d94c391f1
treeffa2cea3d57a05ad91323d34917885d27c24e433
parent4d7ebd54b584ed7adee8c882d2c7f9635b8fba2f
tools/nolibc/string: slightly simplify memmove()

The direction test inside the loop was not always completely optimized,
resulting in a larger than necessary function. This change adds a
direction variable that is set out of the loop. Now the function is down
to 48 bytes on x86, 32 on ARM and 68 on mips. It's worth noting that other
approaches were attempted (including relying on the up and down functions)
but they were only slightly beneficial on x86 and cost more on others.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/string.h