From 457047a8beb352de931e897507bf787a35ef3e3d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 17 Jan 2007 18:18:50 -0500 Subject: Turn a memmove into a while(), reducing running time by 3.5% in my tests. --- lib/bunzip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/bunzip.c b/lib/bunzip.c index 9a0ec6d8..982e1c51 100644 --- a/lib/bunzip.c +++ b/lib/bunzip.c @@ -346,7 +346,9 @@ int read_bunzip_data(bunzip_data *bd) if (dbufCount>=dbufSize) return RETVAL_DATA_ERROR; i = nextSym - 1; uc = mtfSymbol[i]; - memmove(mtfSymbol+1, mtfSymbol, i); + // On my laptop, unrolling this memmove() into a loop costs 11 bytes + // but shaves 3.5% off the total running time. + while(i--) mtfSymbol[i+1] = mtfSymbol[i]; mtfSymbol[0] = uc; uc = symToByte[uc]; -- cgit v1.2.3