# HG changeset patch # User Rob Landley # Date 1169075930 18000 # Node ID 23aac9d422347399d44df9131af131bd2b7fd7a6 # Parent e82ae73acbd7a2402d994d8260d8e088ca92e429 Turn a memmove into a while(), reducing running time by 3.5% in my tests. diff -r e82ae73acbd7 -r 23aac9d42234 lib/bunzip.c --- a/lib/bunzip.c Wed Jan 17 16:58:51 2007 -0500 +++ b/lib/bunzip.c Wed Jan 17 18:18:50 2007 -0500 @@ -346,7 +346,9 @@ 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];