From 83655f8352dc43a187a26aa98edadab867f90715 Mon Sep 17 00:00:00 2001 From: justin1014 Date: Fri, 27 Sep 2002 03:38:41 +0000 Subject: [PATCH] more bzip2 code reduction, disabled data reduction for now so we can hit targets git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1204 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/bzip2/bzlib_private.h | 2 +- Source/bzip2/randtable.c | 8 +++++--- Source/exehead/fileform.c | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/bzip2/bzlib_private.h b/Source/bzip2/bzlib_private.h index 9290601c..f2cee369 100644 --- a/Source/bzip2/bzlib_private.h +++ b/Source/bzip2/bzlib_private.h @@ -125,7 +125,7 @@ typedef unsigned short UInt16; /*-- Stuff for randomising repetitive blocks. --*/ -extern Int16 BZ2_rNums[513]; +extern Int16 BZ2_rNums[512]; // make this 513 for smaller-data mode. #define BZ_RAND_DECLS \ Int32 rNToGo; \ diff --git a/Source/bzip2/randtable.c b/Source/bzip2/randtable.c index c7f39cdf..2e64b531 100644 --- a/Source/bzip2/randtable.c +++ b/Source/bzip2/randtable.c @@ -63,7 +63,10 @@ #include "bzlib_private.h" -#if 1 + +// smaller data mode that saves 336 bytes of data, but adds 60 bytes of code. +// currently saving code is more important to reach our targets. this may change tho. +#if 0 #define PACK3(x,y,z) ((z) << 20)|((y) << 10)|(x) @@ -264,8 +267,7 @@ void NSISCALL genrtable() #else -Int16 BZ2_rNums[512] - = { +Int16 BZ2_rNums[512] = { 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 733, 859, 335, 708, 621, 574, 73 , 654, 730, 472, diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index d2fba27d..a58a7a53 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -13,7 +13,11 @@ #ifdef NSIS_COMPRESS_USE_BZIP2 #include "../bzip2/bzlib.h" static int bz2_needreinit; -void NSISCALL genrtable(); +// void NSISCALL genrtable(); // using this method reduces data by 336, but adds ~60 to code. +// currently it makes sense to spend the money on data and reduce code size, but that may change. +#define genrtable() + + #define z_stream bz_stream #define inflateInit(x) { if (BZ2_bzDecompressInit(x)<0) return _LANG_INVALIDCRC; } #define inflate(x) BZ2_bzDecompress(x)