aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-01-17 18:18:50 -0500
committerRob Landley <rob@landley.net>2007-01-17 18:18:50 -0500
commit457047a8beb352de931e897507bf787a35ef3e3d (patch)
tree4d9c0b80a7261104a3ecb562791d47075fdc4bc3 /lib
parent6c8eaae1387f9739e56456c9574ec5435d240fe6 (diff)
downloadtoybox-457047a8beb352de931e897507bf787a35ef3e3d.tar.gz
Turn a memmove into a while(), reducing running time by 3.5% in my tests.
Diffstat (limited to 'lib')
-rw-r--r--lib/bunzip.c4
1 files changed, 3 insertions, 1 deletions
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];