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>
Mon, 14 Feb 2022 18:48:54 +0000 (10:48 -0800)
commitfffda88a55763ab63e68034e077531f421fced0f
treed17241fbb2b6df47eb74a4b3f5deded853a9081d
parenta824078c6a8b051513b76bbf7c4f756ea1093106
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