aboutsummaryrefslogtreecommitdiff
path: root/archival/bz/huffman.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-12-02 08:35:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-12-02 08:35:37 +0000
commitab801874f852312787c049272c20b14e06ed8195 (patch)
tree1cfd38cfe48ed6a6625ce559ab7f3e5778a980be /archival/bz/huffman.c
parent8003e266edbc0ec62a586dd70dcc80dc13e2dbf0 (diff)
downloadbusybox-w32-ab801874f852312787c049272c20b14e06ed8195.tar.gz
busybox-w32-ab801874f852312787c049272c20b14e06ed8195.tar.bz2
busybox-w32-ab801874f852312787c049272c20b14e06ed8195.zip
attack the biggest stack users:
-mkfs_minix_main [busybox_unstripped]: 4288 -mkfs_minix_main [busybox_unstripped]: 4276 -grave [busybox_unstripped]: 4260 (bzip2 users too - not listed) price we pay in code size increase: mainSort 2458 2515 +57 grave 1005 1058 +53 sendMTFValues 2177 2195 +18 BZ2_blockSort 122 125 +3 mkfs_minix_main 3070 3022 -48 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 131/-48) Total: 83 bytes
Diffstat (limited to 'archival/bz/huffman.c')
-rw-r--r--archival/bz/huffman.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/archival/bz/huffman.c b/archival/bz/huffman.c
index 02838c496..676b1af66 100644
--- a/archival/bz/huffman.c
+++ b/archival/bz/huffman.c
@@ -98,7 +98,8 @@ void DOWNHEAP1(int32_t *heap, int32_t *weight, int32_t nHeap)
98 98
99/*---------------------------------------------------*/ 99/*---------------------------------------------------*/
100static 100static
101void BZ2_hbMakeCodeLengths(uint8_t *len, 101void BZ2_hbMakeCodeLengths(EState *s,
102 uint8_t *len,
102 int32_t *freq, 103 int32_t *freq,
103 int32_t alphaSize, 104 int32_t alphaSize,
104 int32_t maxLen) 105 int32_t maxLen)
@@ -110,9 +111,14 @@ void BZ2_hbMakeCodeLengths(uint8_t *len,
110 int32_t nNodes, nHeap, n1, n2, i, j, k; 111 int32_t nNodes, nHeap, n1, n2, i, j, k;
111 Bool tooLong; 112 Bool tooLong;
112 113
114 /* bbox: moved to EState to save stack
113 int32_t heap [BZ_MAX_ALPHA_SIZE + 2]; 115 int32_t heap [BZ_MAX_ALPHA_SIZE + 2];
114 int32_t weight[BZ_MAX_ALPHA_SIZE * 2]; 116 int32_t weight[BZ_MAX_ALPHA_SIZE * 2];
115 int32_t parent[BZ_MAX_ALPHA_SIZE * 2]; 117 int32_t parent[BZ_MAX_ALPHA_SIZE * 2];
118 */
119#define heap (s->BZ2_hbMakeCodeLengths__heap)
120#define weight (s->BZ2_hbMakeCodeLengths__weight)
121#define parent (s->BZ2_hbMakeCodeLengths__parent)
116 122
117 for (i = 0; i < alphaSize; i++) 123 for (i = 0; i < alphaSize; i++)
118 weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; 124 weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
@@ -189,6 +195,9 @@ void BZ2_hbMakeCodeLengths(uint8_t *len,
189 weight[i] = j << 8; 195 weight[i] = j << 8;
190 } 196 }
191 } 197 }
198#undef heap
199#undef weight
200#undef parent
192} 201}
193 202
194 203